Class MatsTestBroker.MatsTestBroker_Artemis

java.lang.Object
io.mats3.test.broker.MatsTestBroker.MatsTestBroker_Artemis
All Implemented Interfaces:
MatsTestBroker
Enclosing interface:
MatsTestBroker

public static class MatsTestBroker.MatsTestBroker_Artemis extends Object implements MatsTestBroker
Creates a connection to an Artemis broker.
  • Field Details

    • _connectionFactory

      protected final javax.jms.ConnectionFactory _connectionFactory
    • _artemisServer

      protected final org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ _artemisServer
  • Method Details

    • createArtemisBroker

      public static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ createArtemisBroker(String brokerUrl)
    • createArtemisBroker_Should_Be_Individual_DLQs_But_Does_Not_Work

      public static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ createArtemisBroker_Should_Be_Individual_DLQs_But_Does_Not_Work(String brokerUrl)
      This is an attempt to get Artemis to use the "separate DLQ per queue" solution. They do reference this directly in the documentation, but I cannot get this configuration to work. Needs more research. https://github.com/apache/activemq-artemis/blob/main/docs/user-manual/en/undelivered-messages.md#automatically-creating-dead-letter-resources Note that I've encountered two different problems:
      1. It seemingly just doesn't work! Evidently, what should happen is that all DLQs goes to the "DeadLetterAddress" Address specified, but then there should be created original-queue specific DLQ Queues that consume from these using a Filter that only consume the correct DLQs from the Address. However, I cannot see these queues.
      2. The DLQ address and queues are seemingly not "persistent" - they are auto-generated, and as such are auto-deleted when not needed. This however seems to imply that if there are no consumer to the queue when a dead letter is created, it will just not be delivered to that queue at all?! Thus, sometimes when the MatsTestBrokerInterface starts looking for the DLQ, it is not there (and this logic would, if correct, obviously make it useless in a production setup, as the entire idea there is that the actual dead letters should stick around to someone gets to look at them). Note that this is not a problem with the current setup, and the reason for that is, AFAIU, that the actual DLQ address and queue are specified explicitly in the AddressConfiguration. I assume that this could be fixed by using an AddressSetting that specified autoDeleteAddresses=false and autoDeleteQueues=false, as I've tried to do in the code below. However, since I can't the original intent of getting a specific DLQ per queue to work, I do not know if that would work either.
    • getConnectionFactory

      public javax.jms.ConnectionFactory getConnectionFactory()
      Specified by:
      getConnectionFactory in interface MatsTestBroker
      Returns:
      the ConnectionFactory connecting to the broker.
    • close

      public void close()
      Description copied from interface: MatsTestBroker
      Stops the created in-vm broker, if it was created (read MatsTestBroker.SYSPROP_MATS_TEST_BROKERURL). Called "close()" to hook into the default Spring lifecycle if it is instantiated as a Spring Bean.
      Specified by:
      close in interface MatsTestBroker