Spring consolidates ACTIVEMQ and debugging JMS

Source: Internet
Author: User
Tags xmlns

This article is a simple way to integrate spring and ACTIVEMQ, only for reference learning, with a focus on understanding the concept.

1:JMS is a standard API developed by Sun to access message-oriented middleware (MOM), and the MOM component in this article is activeMq. You can download activeMq packages to the http://activemq.apache.org/download.html Web site,

It is very simple to use, after decompression directly run the D:\activemq-4.1.1\bin directory under the Activemq.bat file, start the service on it. And we are simply testing, so we do not need to configure the relevant content of Jndi. Service startup

Then we saw that the corresponding port was activated so that my mom component was ready ...

2: Next, we create a new Web project (I use MyEclipse), import related packages, recommend that you do not use the MyEclipse in the spring2.0 package, because several projects are because of this debugging for a long time, because the package has a problem. Oh.

Import Spring2.0.jar, Apache-activemq-4.1.1.jar, Commons-pool-1.2.jar, Long4j.jar, Commons-logging-1.1.jar files to the Lib directory. Next, create a new two XML file under Web-inf

<?xml version= "1.0" encoding= "UTF-8"?> <beans "xmlns=" xmlns: Xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:tx= "Http://www.springframework.org/schema/tx" xsi:

Schemalocation= "Http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/sprin G-beans-2.0.xsd http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2. 0.xsd "> <bean id=" connectionfactory "class=" Org.apache.activemq.pool.PooledConnectionFactory "> &LT;PR Operty name= "ConnectionFactory" > <bean class= "org.apache.activemq.ActiveMQConnectionFactory" > 
      ;p roperty name= "Brokerurl" > <value>tcp://localhost:61616</value> </property> </bean> </property> </bean> <bean id= "dest" class= "org.apache.activemq.command.Act Ivemqqueue "> <constructor-arG value= "Mydest"/> </bean> <bean id= "jmstemplate" class= "Org.springframework.jms.core.JmsTemplate" & 
    Gt <property name= "ConnectionFactory" ref= "ConnectionFactory" ></property> <property name= " Defaultdestination "ref=" dest "/> </bean> <bean id=" Messagesender "class=" Com.bo.impl.MessageSender " > <property name= "jmstemplate" ref= "jmstemplate" ></property> </bean> </beans>

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.