...
Both aspects are critical for enterprise applications and their implementation is not an easy task. Is there any solution? Yes: Spring JMS functionality and CXF Features. Let discuss them in detail.
- Some JMS vendors provide integrated session pooling in ConnectionFactory. In this case using CachingConnectionFactory is not necessary. Please refer vendor documentation to clear it.
Spring JMS functionality
Spring provides a number of useful classes that helps to implement scalable JMS application. Important for us are: org.springframework.jms.connection.CachingConnectionFactory
org.springframework.jms.listener.DefaultMessageListenerContainer
...
It is possible to define here:
- initial Initial and maximal number of concurrent consumers. This tells the Spring to always start up a initial number of consumers (concurrentConsumers). When a new message has been received, if the maxConcurrentConsumers has not been reached, then a new consumer is created to process the message.
- cache Cache level (3- cache connection, session and consumers; 2 – cache connection and session, 1 – cache connection only)
- specify Specify message listener class (implementing MessageListener interface) and connection factory.
It is important to be aware of following things related to consumers caching: a)
- it doesn't make sense to increase the number of concurrent consumers for a JMS topic. This just leads to concurrent consumption of the same message.
...
- the concurrentConsumers property and the maxConcurrentConsumers property can be modified at runtime, for example, via JMX.
For the details you can refer following Bruce Snider's blog: http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html.
You can see that Spring provides solution for both mentioned scalability aspects. But how we can use it in CXF?
...
- CXF JMS Transport: http://cxf.apache.org/docs/jms-transport.html
- CXF Features: http://cxf.apache.org/docs/features.html
- Spring JMS functionality: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jms.html
- Spring JMS performance tunning: http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html
- CXF performance: http://www.liquid-reality.de/pages/viewpage.action?pageId=5865562
...