1 Reply Latest reply on Aug 9, 2019 4:08 AM by jmesnil

    How to do distributed transaction with artemis core api in wildfly

    wwang2016

      Hi,

       

      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 );

                      consumer.receive(5000);

       

      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?

       

      Thanks,

       

      Wayne