1

I'm writing a service and I need to use transactions for JDBC & JMS but not distributed.Is it possible use Spring @Transactional annotation on JMS Listener method for a JMS only Transacion using Bitronix or Atomikos since these 2 are also autoconfigured by Spring ?

As far as I know, when I add this dependency, my dataBase transaction also became XA.

What are my options ?

1 Answer 1

1

Please see the boot documentation about Mixing XA and non-XA JMS connections.

Sign up to request clarification or add additional context in comments.

7 Comments

OK, but I then I need to set spring.datasource.xa.dataSourceClassName= property, and , I'm usign MSSQL DB, it gives error:javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: Could not find stored procedure 'master..xp_sqljdbc_xa_recover because Db is not configured for XA. what I want is to enable 2 transaction managers, 1 for JMS, 1 for JDBC. I can type the name of the transaction manager if necessary. I'm just curious if it's possible by default or after adding Bitronix or Atomikos, I assume it's necessary, what can I do minimally to achieve this ?
Or, do I need this in the first place ? If I get exception, even without transaction, what happends on JMS side ? Does it retry the message, I'm using persistent queues ?
You can just use local transactions (acknowledge="transacted") on the inbound listener container and it will just use a local JMS transaction (no @Transactional or transaction manager needed).
JMSListener doesn't have acknowledge="transected" property. also, what is difference between sessionAcknowledgeModeName and sessionTransacted ? I believe it'd be bice to add these parameters to JMSProperties so spring-boot can configure them automatically.
Sorry - I didn't realize you were using an annotation based listener; the xml parser coerces transacted ackmode to setSessionTransacted(). Looks like you might need a custom listener container factory to set that; subclass the default factory and override initializeContainer; I am not sure why it's not exposed by default; I'll ask the devs.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.