JDBC and JMS (Activemq) In Tomcat

85 views
Skip to first unread message

Chege Kĩnũthia

unread,
Jun 1, 2022, 11:36:21 AM6/1/22
to narayana-users
Hi,

I have a servlet that should write to  postgres and send messages.
How do I achieve such a set up with narayana.
I have gone through the samples. The jdbc part is well explained in the samples but I could not find anything jms related.

Should I use JCA connector that comes with activemq? How to I configure activemq connection factory to participate in  a JTA transaction?


Thanks,
Chege.

Manuel Finelli

unread,
Jun 6, 2022, 7:27:47 AM6/6/22
to narayana-users

Hi Chege,

From reading ActiveMQ’s documentation, I think that your goal cannot be achieved using Tomcat and ActiveMQ. In fact, from the documentation:

manually integrating ActiveMQ with Tomcat does allow for Topic, Queue, and ConnectionFactory injection but does NOT support transactional sending and delivery.

To answer your question:

Should I use JCA connector that comes with activemq? How to I configure activemq connection factory to participate in  a JTA transaction?

ActiveMQ can be used in XA transactions, which can be managed using Narayana. For example, an option would be to use TomEE and integrate it with Narayana. You should then be able to run XA transactions enlisting ActiveMQ and PostgreSQL.

Manuel

Marco Sappe Griot

unread,
Jun 6, 2022, 8:38:48 AM6/6/22
to narayana-users
Hi Chege,
I agree with Manuel, I would not suggest you to use Tomcat for what you want to accomplish.
I might suggest you to have a look at this quickstart with wildfly and JMS: https://github.com/jbosstm/quickstart/tree/master/jta-1_2-in-wildfly, in particular this class.
Best Regards,
Marco

Michael Musgrove

unread,
Nov 14, 2023, 5:50:41 AM11/14/23
to narayana-users
Chege, I am going to mark this question as complete, but if you need further input then please ask.
Reply all
Reply to author
Forward
0 new messages