First understanding of ActiveMQ Message Middleware

Source: Internet
Author: User

ActiveMQ is an open-source project of Apache. It is an open-source message bus with strong capabilities and a middleware product. It is an implementation of JMS. Before introducing ActiveMQ, let's review the JMS specifications in J2EE. JMS is short for java Message Service. It is used to send asynchronous messages. It can be used for integration between different systems and modules. JMS has two advantages. The first is to reduce the coupling between modules or systems, and the second is asynchronous communication. The message mechanism of JMS has two models: Point to Point, which are displayed as a queue. A message can only be taken away by one receiver. The other is a Topic, which can be subscribed to by multiple subscribers, similar to a group. Www.2cto.com has several important core interfaces and classes in JMS: 1. ConnectionFactory, which is used by the jms client to obtain the connection with the jms provider. Different jms products have different implementations for this interface, such as ActiveMQ. The implementation class of this interface is ActiveMQConnectionFactory 2. connection is generated by ConnectionFactory, indicating the Connection between the jms client and the jms provider. session, which is generated by Connection, indicates a Session. Session is a key component. Message, Producer, Consumer, and Destination are all created on Session. message, which is a Message transmitted, including head, properties, and body. The head is required. destination is the source of the message. For the sender, it refers to where the message is sent; for the receiver, it refers to where the message is obtained. Destination has two subinterfaces, Queue and Topic, which correspond to the two models mentioned above. messageProducer is the message sender. The code for creating this component is similar to: Java code: [java] Destination dest = session. createQueue ("dotaQueue"); // Message destination MessageProducer producer = session. createProducer (dest); // The message sender notices that Destination must be used as a parameter to pass in the createProducer () method. This indicates that the message sender is bound to Destination, the message sent by the sender will be sent to the bound Destination 7. messageConsumer is the Message receiver. It is the opposite component of Message Producer. After learning about JMD, let's take a look at Acti. VeMQ. Run activemq in the bin directory. when bat starts mq, mq occupies at least two ports. The default values 61616 and 8161 are waiting for the connection of the jms client, and 61616 is a web application http: // localhost: That comes with ActiveMQ: 8161/demo, you can see a variety of official examples http: // localhost: 8161/admin, is the ActiveMQ Management Console, we can create a message queue in the management console:

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.