I am investigating the Artemis queue with queue filter capability. The two major benefits of this type of queue (not the jms queue) are:
(1) You can define a list of queues under on address
(2) In the case of paging scenario, message consumption from different queues will not cause performance issue. However, this happens with message selector which send messages with different property value to the same queue and message consumption with message selector can have performance issue during paging scenario. (Chapter 11. Configuring Paging - Red Hat Customer Portal )
The question is about how to support distributed transaction. Note, XA transaction is automatically supported if we could use PoolConnectionFactory. However, queue defined this way can not seem to be accessed through JNDI lookup from wildfly (v17.1), and it can only be access through core API
ServerLocator serverLocator = ActiveMQClient.createServerLocator( "vm://0" ); //$NON-NLS-1$
ClientSessionFactory factory = serverLocator.createSessionFactory();
ClientSession session = factory.createSession();
ClientConsumer consumer = session.createConsumer( QUEUE_NAME );
If we allow consumer to consume a message and save it to database, how do we ensure these two transactions will be managed as one unit?
You can call factory.createXASession(); to get a sessions that supports XA.
However you should ask this question to the Artemis mailing list: they might have better insight on this approach.