이 콘텐츠는 선택한 언어로 제공되지 않습니다.

2.2. JMS Message Basics


Overview

Messages are the backbone of a messaging system and the most important part of the JMS specification. A messages is a self-contained autonomous entity that may be resent several times across many clients throughout its life span. Each consumer along a message's route will examine it and, depending on its contents, may execute some business logic, modify it, or create new messages to accomplish a communicated task.

Message anatomy

As shown in Figure 2.1, “Anatomy of a JMS message”, a JMS message consists of three components:
  • headers
  • properties
  • body

Figure 2.1. Anatomy of a JMS message

JMS message with headers, properties and body broken out

Message body

The body component contains the payload, which can be textual or binary data, as specified by using one of the six supported Java message types:
Table 2.1. Java message types
Message TypeDescription
MessageBase message type. Payload is empty; only headers and properties are active. Typically used for simple event notification.
TextMessagePayload of type String. Typically used to transmit simple text and XML data.
MapMessagePayload of name/value pairs, with names of type String and values of Java primitive type.
BytesMessagePayload is an array of uninterpreted bytes.
StreamMessagePayload is a stream of Java primitive types, filled and read sequentially.
ObjectMessagePayload is a serializable Java object. Usually used for complex Java objects, but also supports Java collections.

Message headers

Message headers contain a predefined set of metadata that are used to communicate information about a message between the different parties that handle the message. The header properties are identified by a JMS prefix and outlined in the JMS specification.
A number of the headers are automatically assigned by the producer's send() method and some are automatically set by the broker. The remaining headers are left to the user to set when a message is created.

Message properties

Message properties, like message headers, provide metadata about a message to the different parties that handle the message. The difference between message headers and message properties is that message properties are not standardized. They allow JMS providers and client applications to add their own metadata to a message. A messaging client does not need to understand the properties to consume a message containing them. Unrecognized properties are simply ignored.
Client applications can create used-defined properties based on Java primitive types. The JMS API also provides generic methods for working with these user-defined properties.
Red Hat JBoss A-MQ has a number of vendor specific message properties that are used to control how the broker treats messages, The JBoss A-MQ specific properties are identified by the JMSActiveMQBroker prefix.
There are a few JMS-defined properties that are identified by the JMSX prefix. Vendors are not required to support all of these properties.
For a list of supported headers and properties, see ActiveMQ in Action (Snyder, Bosanac, and Davies).
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.