Java message queue _Activemq --JMS articles

1. What is JMS

           JMS is the Java Message Service (Java Message Service) application program interface, which is an API for message -oriented middleware (MOM) in the Java platform , which is used to send messages between two applications or in a distributed system for asynchronous communication. Java Message Service is a platform-independent API, and most MOM providers support JMS.

2. Advantages of JMS

  1.     Asynchronous

        JMS is asynchronous by default. So to receive a message, the client is not required to send the request. The message will arrive automatically to the client as they become available. When there is no need to actively send a request, the message will be automatically sent to the available client)

  2.     Reliable

        JMS provides the facility of assurance that the message will be delivered once and only once. You know that duplicate messages create problems. JMS helps you avoid such problems. JMS can help you avoid this problem.)


3. JMS message model

                The JMS object model includes the following elements: [2] 
                     1) Connection factory. The connection factory (ConnectionFactory) is created by the administrator and bound to the JNDI tree. The client uses JNDI to find a connection factory, and then uses the connection factory to create a JMS connection.
                     2) JMS connection. JMS connection (Connection) represents an active connection between the JMS client and the server, which is established by the client by calling the method of the connection factory.
                     3) JMS session. JMS session (Session) represents the session state between the JMS client and the JMS server. A JMS session is established on a JMS connection and represents a session thread between the client and the server.
                     4) JMS purpose. The JMS destination (Destination), also known as the message queue, is the actual source of the message.
                     5) JMS producers and consumers. Producer (Message Producer) and consumer (Message Consumer) objects are created by the Session object to send and receive messages.

                    6) There are usually two types of JMS messages:
                    ① Point-to-Point. In a peer-to-peer messaging system, messages are distributed to a single consumer. Point-to-point messages are often associated with queues (javax.jms.Queue).
            
                    ② Publish/Subscribe. The publish/subscribe messaging system supports an event-driven model where both message producers and consumers participate in the delivery of messages. Producers publish events, while consumers subscribe to events of interest and consume them. Messages of this type are generally associated with a specific topic (javax.jms.Topic).





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324423066&siteId=291194637