Spring Integrated ACTIVEMQ

Source: Internet
Author: User
Tags connection pooling

Applicationcontext.xml configuration file:

<!--Properties File configuration--<bean id= "Propertyconfigurer" class= "            Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer "> <property name=" Locations "> <list> <value>classpath:jdbc.properties</value> </list> &lt ;/property> </bean> <!--dbcp--<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDat        Asource "destroy-method=" Close "> <property name=" driverclassname "value=" ${driverclassname} "/> <property name= "url" value= "${url}"/> <property name= "username" value= "${username}"/> &L T;property name= "Password" value= "${password}"/> <!--connection initial value, the initial value of the number of connections created when connection pooling starts is 0--and <prope Rty name= "InitialSize" value= "3"/> <!--minimum idle value. When the number of idle connections is less than the threshold, the connection pool will pre-apply for some connections to avoid the flood peaks when the default value is 0--and &L T;property name= "Minidle" value= "3"/> <!--maximum idle value. After a peak time, the connection pool can slowlySlowly release a portion of the unused connection until Maxidle, 0 o'clock the unrestricted default is 8--<property name= "Maxidle" value= "5"/> <!--connection pool The maximum number of connections that can be allocated from the pool at the same time, 0 o'clock the unrestricted default is 8--<property name= "maxactive" value= "/> <property name        = "Minevictableidletimemillis" value= "1800000"/> <property name= "Numtestsperevictionrun" value= "3"/> <property name= "Testonborrow" value= "true"/> <property name= "Testwhileidle" value= "true"/> &L T;property name= "Testonreturn" value= "true"/> <property name= "validationquery" value= "Select 1"/> </ bean> <!--1.jedisPoolConfig Configuration objects--<!--temporary local Redis database--<bean id= "Jedispoolconfig" class= " Redis.clients.jedis.JedisPoolConfig "> <!--Maximum Connections--<property name=" Maxtotal "value=" >&lt ;/property> <!--idle Maximum number of connections-<property name= "Maxidle" value= "5" ></property> </bea N> <!--2.jedisPool Connection Pool Object--<bean id= "Jedispool" class= "Redis.clients.jedis.JedisPool" > <!--injecting data using a construction method-- <constructor-arg index= "0" ref= "jedispoolconfig" ></constructor-arg> <constructor-arg index= "1 "Type=" java.lang.String "value=" 127.0.0.1 "></constructor-arg> <constructor-arg index=" 2 "value=" 6379 "& gt;</constructor-arg> </bean> <bean id= "Autoproxycreator" class= "Org.springframework.aop.frame Work.autoproxy.DefaultAdvisorAutoProxyCreator "> <property name=" Proxytargetclass "> <value&gt  ;true</value> </property> </bean> <!--can actually generate connection connectionfactory, provided by the corresponding JMS service vendor --<bean id= "targetconnectionfactory" class= "Org.apache.activemq.ActiveMQConnectionFactory" > <prop Erty name= "Brokerurl" value= "tcp://localhost:61616"/> </bean> <bean id= "ConnectionFactory" class = "ORG.SPRINGFRAMEWORK.JMS.connection.singleconnectionfactory "> <property name=" targetconnectionfactory "ref=" Targetconnectionfactory "/> </bean> <!--This is the queue destination, point-to-point--<bean id=" queuedestination "class=" or        G.apache.activemq.command.activemqqueue "> <constructor-arg> <value>queue</value> </constructor-arg> </bean> <!--This is the theme destination, one-to-many <bean id= "topicdestination" class= "Org.apache . activemq.command.ActiveMQTopic "> <constructor-arg value=" topic "/> </bean>-<!--configuration J Ms Template (Queue), Spring provides the JMS tool class, which sends and receives messages. --<bean id= "jmstemplate" class= "org.springframework.jms.core.JmsTemplate" > <property name= "Connect        Ionfactory "ref=" ConnectionFactory "/> <property name=" defaultdestination "ref=" QueueDestination "/>         <property name= "ReceiveTimeout" value= "10000"/> <!--true is Topic,false is a queue, the default is False, here the display writes out false-- &lT;property name= "Pubsubdomain" value= "false"/> </bean> <!--configuration Listener--<bean id= "Mymessageliste Ner "class=" Com.alibaba.otter.canal.example.listener.MyMessageListener "/> <!--message listening container--<bean id=" JMS Container "class=" Org.springframework.jms.listener.DefaultMessageListenerContainer "> <property name=" c        Onnectionfactory "ref=" ConnectionFactory "/> <property name=" destination "ref=" Queuedestination "/>     <property name= "MessageListener" ref= "Mymessagelistener"/> </bean>

Spring Integrated ACTIVEMQ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.