ACTIVIMQ (1)

Source: Internet
Author: User
Tags amq

Tag: It's end produces string rod CTE reply timestamp message passing

1. ACTIVIMQ is the message middleware (Provider) that implements the JMS interface and specification.

2. Jms,java Message Service, Java messaging Services, is a technology in Java EE

3. JMS Specification: JMS defines the interface that accesses the message middleware in Java, and does not give implementation, the message middleware that implements the JMS interface becomes JMS Provider, for example ACTIVEMQ

4. JMS MESSAGE:JMS message, JMS message consists of three parts:

① message header: Each message header field has a corresponding getter and Sertter method

The message header contains the message's identifying information and routing information, and the message header contains some of the standard properties as follows

(1) Jmsdestination: set by the Send method, the destination of the message, mainly indicates queue and topic, automatically assigned

(2) Jmsdeliverymode: set by the Send method, transfer mode. There are two types of persistence and non-persistent modes. A persistent message should be delivered "once in a while", meaning that if the JMS provider fails, the message is not lost and will be delivered again after the server resumes. A non-persisted message is delivered at most once, which means that the server fails and the message is lost forever. Auto Assign

(3) Jmsexpiration: Set by the Send method, the message expiration time, equal to the TimeToLive value in the destination Send method plus the GMT time value of the Send time, If the TimeToLive value equals zero jmsexpiration is set to zero, that message never expires. If the message has not been sent to the destination after the message expires after it has been sent, the message is cleared and automatically assigned

(4) Jmspriority: set by the Send method: Message priority, from 0-9 10 levels, 0-4 is a normal message, and 5-9 is an expedited message. JMS does not require JMS provider to send messages strictly in accordance with these 10 priority levels, but must ensure that expedited messages arrive before ordinary messages. The default is level 4. Auto Assign

(5) Jmsmessageid: set by the Send method, uniquely identifies the representation of each message, Jmsprovider generated, automatically assigned

(6) Jmstimestamp: Set by the client, a jmsprovider is automatically set when the Send method is called, its message is sent and the consumer actually receives the time difference, automatically assigns

(7) Jmscorrelationid: Set by the client, used to connect to another message, the typical application is to link to the hospital message in the reply message, in most cases, Jmscorrelationid is used to mark a message as an answer to the previous message Jmsmessageid marked, but Jmscorrelationid can be any value, not just jmsmessageid. Set by developer

(8) Jmsreplyto: Set by client, provide the destination address of this message reply message, set by developer

(9) Jmstype: Set by client, message type identifier, developer settings

Jmsredelivered: Set by JMS provider, if a client receives a message with the Jmsredelivered property set, it means that the client may have received the message earlier, but did not sign (acknowledged). If the message is re-routed, jmsredelivered=true vice versa, Jmsredelivered=false. Automatically set

② Message Properties: If you need a value other than the message header field, you can use the message property

Contains the three types

(1) Application settings and added properties, such as:

Message.setstringproperty ("username", username);

(2) JMS Definition Properties

Use "JMSX" as the prefix for the property name, Connection.getmetadata (). Getjmsxpropertynames (), and the method returns the name of the JMS property supported by all connections.

1. Jmsxuserid: Send message User ID, send when provider settings

2. Jmsappid: App ID for sending messages, provider settings when sending

3. Jmsxdeliverycount: Forwarding message retry count, first time 1, second time 2, ..., Delivery provider settings

4. Jmsxgroupid: The identity of the message group where the message is located, set by the client, and so on (72-33m)

(3) JMS Vendor-specific attributes

③ message body: Encapsulates specific message data

The JMS API defines 5 message body formats, also called message types, that can be sent in different forms, accept data, and be compatible with existing message formats. Including TextMessage, Mapmessage, Bytesmessage, Streammessage, ObjectMessage.

5. JMS Producer: Message producer, client app for creating and sending JMS messages

6. JMS Consumer: Message consumers, client applications that receive and process JMS messages

Message consumption can take one of the following two methods:

①: Synchronous consumption: The Receive method can be blocked until the message arrives by calling the consumer's receive method to display the extracted message from the destination

②: Asynchronous consumption: Customers can register a message listener for the consumer to define the action taken when the message arrives

7. A-----m---->AMQ------m---->b

A: Message Producers

B: Message Consumers

AMQ: Message middleware (ActiveMQ)

8. JMS domains: Messaging domain, two types of messaging domains defined in the JMS specification: Point-to-point (point-to-point: abbreviated PTP) Messaging domain and publish/subscribe Messaging domain (publish/subscribe, abbreviated to PUB/SUB)

(1) The characteristics of the point-to-point message delivery domain are as follows:

① only one consumer per message

There is no time correlation between the producer and the consumer of the ② message. Whether the consumer is running when the producer sends the message, he can extract the message

9. The Publish/Subscribe messaging domain is characterized by the following:

① can have multiple consumers per message

② There is a time-dependent relationship between producers and consumers, consumers who subscribe to a topic can only consume messages posted after it has been subscribed to, and the JMS specification allows customers to create durable subscriptions, which in some way relaxes the time-related requirements. A persistent subscription allows a consumer to consume messages that it sends when it is not in the active state

10. In a point-to-point messaging domain, the destination is called a queue; in a publish/subscribe messaging domain, the destination is called the subject (topic).

11.ConnectionFactory: Connection factory, used to create connection objects to connect to JMS provider

12.JMS Connection: Encapsulates a virtual connection between the customer and the JMS provider

13.JMS Session: A single thread context for production and consumption messages

Sessions are used to create message producers (producer), Message consumers (consumer), and messages (message), and so on. A session provides a transactional context in which a set of send and receive is combined into an atomic operation.

Destination: The destination to which the message was sent (Queue/topic)

15.Acknowledge: Sign In

16.Transacted: Transaction

17.JMS Client: Java application for sending and receiving messages

18.NON-JMS Client: An application written using the JMS provider native API to replace the JMS API's ability to send and receive messages, often providing other features such as CORBA, RMI, and so on.

19.Administred objects: Predefined JMS objects, typically defined in the provider specification, are provided to JMS clients for access, such as: ConnectionFactory and destination

Activimq (1)

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.