1: The database uses the DBCP configuration.
<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource"
destroy-method= "Close" >
<property name= "Driverclassname" value= "${jdbc.driverclassname}"/>
<property name= "url" value= "${jdbc.url}"/>
<property name= "username" value= "${jdbc.username}"/>
<property name= "Password" value= "${jdbc.password}"/>
<property name= "minpoolsize" value= "${jdbc.minpoolsize}"/>
<property name= "maxpoolsize" value= "${jdbc.maxpoolsize}"/>
<property name= "initialpoolsize" value= "${jdbc.initialpoolsize}"/>
<!--maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. The default is 0--
<property name= "MaxIdleTime" value= "${jdbc.maxidletime}"/>
</bean>
2: Configure ConnectionFactory link Factory
<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.url}"/>
</bean>
</property>
<property name= "MaxConnections" value= "${activemq.maxconnections}" ></property>
</bean>
3: Set the MQ mode to queue for asynchronous receive.
<bean id= "Destination" class= "Org.apache.activemq.command.ActiveMQQueue" >
<constructor-arg index= "0" value= "${activemq.destination}" ></constructor-arg>
</bean>
4: Your Consumer implementation class, handling the main function that receives the message.
<bean id= "Consumer" class= "Com.myself.jms.msgaccepter.action.ConsumerAction" >
<property name= "" ref= "" ></property>
</bean>
5: Message monitoring container, here unified implementation of the ACTINMQ message receiving mechanism.
<bean id= "Listenercontainer" class= "Org.springframework.jms.listener.DefaultMessageListenerContainer" >
<property name= "Concurrentconsumers" value= "${activemq.consumers}"/>
<property name= "ConnectionFactory" ref= "Jmsfactory"/>
<property name= "Destination" ref= "Destination"/>
<property name= "MessageListener" ref= "consumer"/>
</bean>
The values within the 6:$ are recorded through the properties file and support the changes.
Beginner Activemq, wrote a configuration file with spring