JMS学习笔记之internal

JMS学习笔记之internal

A Message object has three parts: the message header, message properties, and finally the message data itself, called the payload or message body

Screen Shot 2020-07-17 at 11.42.24 AM

JMS consumers can choose to receive messages based on the values of certain headers and properties, using a special filtering mechanism called message selectors.


1. Headers

  • automatically-assigned
  • developer-assigned

Auto-Assigned

JMSDestination,

JMSDeliveryMode (persistent and nonpersistent),

JMSMessageID,

JMSTimestamp,

JMSExpiration (By default the timeToLive is zero (0), which indicates that the message doesn’t expire)

JMSRedelivered (A message may be marked redelivered if a consumer failed to acknowledge previous delivery of the message, or when the JMS provider is not certain whether the consumer has already received the message:)

JMSPriority (levels 0–4 are gradations of normal priority, and levels 5–9 are gradations of expedited priority; messages with an expedited priority are delivered ahead of normal priority messages:)

developer-assigned

JMSReplyTo (a JMS consumer is not required to send a reply just because this header property is set:)

JMSCorrelationID (In most cases, the JMSCorrelationID will be used to tag a message as a reply to a previous message identified by a JMSMessageID, but the JMSCorrelationID can be any value, not just a JMSMessageID:)


2. properties

Properties act like additional headers that can be assigned to a message

Property values can be any boolean, byte, short, int, long, float, double, or String.

  • Application-Specific Properties

  • JMS-Defined Properties

  • Provider-Specific Properties


3. message type

TextMessage, StreamMessage, MapMessage, ObjectMessage, and BytesMessage.

Client-Acknowledged Messages

There are three acknowledgment modes that may be set by the JMS consumer when its session is created: AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, and CLIENT_ACKNOWLEDGE.