Hi Justin,
Thanks for your reply and apologies for the delayed response - I'm just back 
from holiday.

We're using Container Managed Transactions in our MDBs but when we inspect the 
type of the connection factory in the bean during runtime it is the non-XA 
version that seems to be being used.

I believe the DB is using XA correctly as when we switch just the message queue 
back to IBM MQ we no longer see the issue.

In terms of the program flow we do the following:
- consume message 1 as MDB
- (lots of processing!)
- write to DB
- write message 2 to message queue (containing ID of record in DB)

And then
- consume message 2 from another MDB
- read record from DB
- app blows up because record is not there / committed

(FYI, this is an old app we're modernising so we're trying to keep the 
application changes to a minimum if we can)

Open Liberty docs are lacking on this unfortunately.

All the best,
Ben

> On 31 Jul 2021, at 17:44, Justin Bertram <jbert...@apache.org> wrote:
> 
> In a Java EE server MDBs are executed with configurable transaction
> semantics. By default, container-managed transaction semantics are used
> which incorporate the consumption of the message by the MDB into a JTA
> (which is XA) transaction which includes all other enlisted resources (e.g.
> databases, JMS servers, etc.). When using bean-managed transaction
> semantics the consumption of the message by the MDB will *not* be part of a
> transaction. What kind of transaction semantics are configured for your MDB?
> 
> XA capable resources (e.g. database connections, JMS connections, etc.)
> should of course be used at each step. The inbound adapter of the JCA RA
> used to receive the message by the MDB should already be using XA
> implicitly if you're using container-managed transactions. Can you confirm
> that your database connection is using XA properly? Are you sending the JMS
> message to another ActiveMQ broker or the same ActiveMQ from which you
> consumed the message with your MDB or perhaps a non-ActiveMQ JMS server?
> How exactly is the connection factory configured which you're using to send
> the message? Configuring XA support for such resources is
> provider-specific. Have you consulted Open Liberty documentation on this
> point of configuration?
> 
> 
> Justin
> 
> On Sat, Jul 31, 2021 at 1:26 AM Ben Pirt <b...@madetech.com> wrote:
> 
>> We're modernising an existing enterprise Java application that relies on
>> XA. It is a message oriented architecture and we're finding race conditions
>> are occurring sporadically.
>> We receive a message into a Message Driven Bean, interact with the
>> database and then fire off another message to another MDB that expects data
>> to be in the DB, however because it's not all wrapped up in one transaction
>> the data isn't there when the second MDB starts processing, so it blows up.
>> 
>> Hope that makes sense!
>> Cheers,
>> Ben
>> 
>>> On 30 Jul 2021, at 22:42, Justin Bertram <jbert...@apache.org> wrote:
>>> 
>>> What behavior do you expect versus what you actually observe? In other
>>> words, what exactly isn't working?
>>> 
>>> Also, what is your XA use-case?
>>> 
>>> 
>>> Justin
>>> 
>>> On Fri, Jul 30, 2021 at 4:33 PM Ben Pirt <b...@madetech.com> wrote:
>>> 
>>>> Hi Justin, we're using JCA with the resource adapter.
>>>> 
>>>> We've defined the RA, the Queue Connection Factory and the Activation
>> Spec
>>>> in the server.xml configuration file.
>>>> 
>>>> Cheers,
>>>> Ben
>>>> 
>>>>> On 30 Jul 2021, at 22:28, Justin Bertram <jbert...@apache.org> wrote:
>>>>> 
>>>>> I'm not too familiar with Open Liberty. Can you be more specific about
>>>> how
>>>>> you're attempting to integrate? Are you using plain JMS or JCA via the
>>>>> ActiveMQ resource adapter?
>>>>> 
>>>>> 
>>>>> Justin
>>>>> 
>>>>> On Fri, Jul 30, 2021 at 7:38 AM Ben Pirt <b...@madetech.com> wrote:
>>>>> 
>>>>>> Hello all,
>>>>>> I wonder if anyone might be able to help us out - we're trying to use
>>>>>> ActiveMQ with Open Liberty but we're struggling to get it using the XA
>>>>>> version of the Queue Connection Factory - does anyone have any idea
>> how
>>>> we
>>>>>> might be able to get XA working on this platform? All help
>> appreciated!
>>>>>> Thanks,
>>>>>> Ben
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 

Reply via email to