🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
How to connect XASession of Solace JMS API with Weblogic Database XAConnection?
Hi Team, Am looking for a way to connect solace XASession with database XA connection (my datasource is on weblogic server) so that if the query execution fails, solace transaction should be rollback when db transaction.rollback is called; and same with commit statement. Or vice-versa - if solace transaction is rolled back, db transaction should also be rolled back.
TIA!
Answers
-
Hey @Richa - not an expert on transactions, but here are some thoughts. One approach you can take is by configuring a global transaction using the Transaction Manager that both the Solace and the Weblogic transactions can participate in. This way, you ensure that the Solace session and the database connection are part of the same global transaction. Take a look at this resource in the docs for more details
Basically, you will use SolXAConnectionFactory to create an XA session and make sure to disable direct transport to ensure that only Guaranteed messages are published or received (which is a requirement for transactions).
For Weblogic, make sure that the XA transaction data source participates in the same global transaction as the Solace session. Read more about configuring global transactions here.
This way, if a part of the transaction fails, the Transaction Manager handles the roll back the entire global transaction which should have XAResource objects obtained from each resource (in this case, Solace and Weblogic).
Hopefully this helps! Feel free to respond back here with your results and observations.
0 -
Hi @Tamimi, thanks for your reply.
Due to my requirement constrain, I cannot use "SolXAConnectionFactory" for direct connection to solace.
Currently, am using solace resource adapter for solace connection via weblogic ( with XA Transaction only). Now to get the connection, am using weblogic initial context factory "weblogic.jndi.WLInitialContextFactory".
PFB ss of java code used for solace connection.
Now, I want post execution of "send" method, when am doing any DB transaction and it get failed, then message send on solace should also be rollback when db transaction.rollback is called.
0 -
Hmm, I wonder if you can programatically create connection factory and XA Connection Factory Objects for your solution. check more details here
This way even if you are using solace resource adapter for solace connection via weblogic you can still have access to the
SolXAConnectionFactory
object0