1. The camel framework supports a large number of enterprise integration models, which can greatly simplify the large number of services and complex message flows between integrated components. The spring framework focuses more on simplicity and supports only basic best practices.
2. The core architecture of the spring message is jmstemplate, which isolates the tedious operations like opening, closing sessions and producer, so application developers simply need to focus on the actual business logic.
However, jmstemplate damage the performance of ACTIVEMQ's pooledconnectionfactory to the caching mechanism of session and message producer.
3, the new spring inside, you can set org.springframework.jms.connection.CachingConnectionFactory sessioncachesize, or simply use the ACTIVEMQ
Pooledconnectionfactory, as follows:
<bean id= "JmsFactory" class= " Org.apache.activemq.pool.PooledConnectionFactory " destroy-method=" Stop "> <property name= "ConnectionFactory" > <bean class= " Org.apache.activemq.ActiveMQConnectionFactory "> <property name= "Brokerurl" > <value>${activemq.brokerurl}</value></ Property><property name= "UserName" value= "${activemq.username}" ></property> <property name= "Password" value= "${activemq.password}" ></property> </bean></property><property name= " MaxConnections " value=" ${activemq.maxconnections} "></property> </bean
4. The Jmstemplate receive () Call is not recommended because all calls on the jmstemplate are synchronous, which means that the calling thread needs to be blocked until the method returns, which has a significant impact on performance.
5. Use Defaultmessagelistenercontainer, which allows you to receive messages asynchronously and cache session and message consumer, and also dynamically increase or decrease the number of listeners based on the number of messages.
<!--consumer listener--><bean id= "Jmscontainer" class= " Org.springframework.jms.listener.DefaultMessageListenerContainer "> <property name=" connectionfactory "ref=" Jmsfactory "/> <property name=" destination "ref=" Destinationtopic "/> <property name=" MessageListener "R ef= "MessageListener"/></bean>
This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1916382
ActiveMQ (): ActiveMQ combined with spring development--recommendations