[jboss-user] [JBoss Messaging] - Re: JmsTemplate w/ JBM still discouraged?
do-not-reply at jboss.com
Fri Oct 10 04:07:52 EDT 2008
"clebert.suconic at jboss.com" wrote : anonymous wrote : it would be nice to add this as a suggested solution to the JBMSpringJMSTemplateNotes page that warns against using JmsTemplate with JBoss Messaging.
| This should be the same on any JMS provider you choose. Creating a Session/Producer on every message send is an anti-pattern , and it will certainly cause performance issues on any JMS server you choose.
| You can use the java://JmsXA connector on JBoss AS also, and on that case SpringJMSTemplate would be using the cached producers from JBAS' JCA and you wouldn't see any performance problem.
That's partially correct.
Using JMSXA only caches sessions, message producers and message consumers are never cached. So using JMSXA will always have a less performance than doing your own sensible consumer/producer management in your own program.
Having said, that producer creation overhead is pretty small in JBM 1.4 since it only creates objects on the client side. Message consumer creation is much higher since it involves a network round trip.
There's an even worse issue. If you're creating a consumer each time to receive a message and its non durable on a topic. If there are any messages that arrive on the topic between closing one consumer and creating the next one will appear to be "lost" since there's nothing to consume them.
Therefore we only recommend using JmsXA for sending messages. For consuming, you will still see issues.
Please note this is NOT JBoss specific.
The bottom line, is the Spring JMS template does horrible anti-patterns and you can only work around them to some degree.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181387#4181387
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181387
More information about the jboss-user