- All Implemented Interfaces:
- Enclosing interface:
Creates a connection to an Artemis broker.
Nested Class Summary
Field SummaryModifier and TypeFieldDescription
protected 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 SummaryModifier and TypeMethodDescription
close()Stops the created in-vm broker, if it was created (read
static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQThis is an attempt to get Artemis to use the "separate DLQ per queue" solution.
_connectionFactoryprotected final javax.jms.ConnectionFactory _connectionFactory
_artemisServerprotected final org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ _artemisServer
createArtemisBrokerpublic static org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ createArtemisBroker
createArtemisBroker_Should_Be_Individual_DLQs_But_Does_Not_Workpublic 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.
getConnectionFactorypublic javax.jms.ConnectionFactory getConnectionFactory()
closepublic void close()Description copied from interface:
MatsTestBrokerStops 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.