Package io.mats3.test.broker
Class MatsTestBroker.MatsTestBroker_Artemis
java.lang.Object
io.mats3.test.broker.MatsTestBroker.MatsTestBroker_Artemis
- All Implemented Interfaces:
MatsTestBroker
- Enclosing interface:
- MatsTestBroker
Creates a connection to an Artemis broker.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.mats3.test.broker.MatsTestBroker
MatsTestBroker.ActiveMq, MatsTestBroker.MatsTestBroker_ActiveMq, MatsTestBroker.MatsTestBroker_Artemis, MatsTestBroker.MatsTestBroker_InVmActiveMq
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ
protected final javax.jms.ConnectionFactory
Fields inherited from interface io.mats3.test.broker.MatsTestBroker
SYSPROP_MATS_TEST_BROKER, SYSPROP_MATS_TEST_BROKER_VALUE_ACTIVEMQ, SYSPROP_MATS_TEST_BROKER_VALUE_ARTEMIS, SYSPROP_MATS_TEST_BROKER_VALUE_RABBITMQ, SYSPROP_MATS_TEST_BROKERURL, SYSPROP_MATS_TEST_BROKERURL_VALUE_IN_VM, SYSPROP_MATS_TEST_BROKERURL_VALUE_LOCALHOST
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Stops the created in-vm broker, if it was created (readMatsTestBroker.SYSPROP_MATS_TEST_BROKERURL
).static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ
createArtemisBroker
(String brokerUrl) static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ
This is an attempt to get Artemis to use the "separate DLQ per queue" solution.javax.jms.ConnectionFactory
-
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:- 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.
- 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 interfaceMatsTestBroker
- 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 (readMatsTestBroker.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 interfaceMatsTestBroker
-