[jboss-user] [JBoss Messaging] - Sending Messages from EJB using container transaction
do-not-reply at jboss.com
Tue Apr 7 01:26:26 EDT 2009
We have a requirement to send thousands of messages using EJB in a day. Thus every time a need arises to send a message, we have a dedicated session bean which will post message to the queue as part of EJB (container) transaction. We are using JBoss EAP 4.3.0.
Our question is what will be the right connection factories to use. Currently we are using /ConnectionFactory to send messages but it seems that it does not uses container transaction. If we use session transacted session it sends message only if we explicitly commit the transaction and it seems to have two transactions running in parallel i.e. container transaction & JMS transaction which are independent of each other. Thus we used session transacted as false and AUTO_ACK true but with this we face another problem that messages are delivered to consumer even before the EJB i.e. container transaction finishes. Thus regardless the originating transaction was successful, complete or failed, the message is delivered to consumer which gives unreliable results
Our requirement is that message should be delivered to consumer only if the originating EJB transaction was successful else the message posted should be de-queued. The whole infrastructure should be fast to process the message.
We want to know what will be the most appropriate approach to get best performance and reliability
1. Which connection factory to use so that JMS uses Container transaction? Currently we are using /ConnectionFactory
2. Do we need to open connection every time we send a message or we can have a connection object initialized in post construct of Session bean. Currently we create it at post construct of session EJB
3. Do we need to create session every time we send a message or we can have a session object initialized in post construct of Session bean. Currently we create it every time.
4. What all points should we take care from performance tuning perspective. We are using MS-SQL Server 2005.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223867#4223867
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223867
More information about the jboss-user