Search

Chapter 11. Interoperability

download PDF

This chapter discusses how to use AMQ JMS in combination with other AMQ components. For an overview of the compatibility of AMQ components, see the product introduction.

11.1. Interoperating with other AMQP clients

AMQP messages are composed using the AMQP type system. Having this common format is one of the reasons AMQP clients in different languages are able to interoperate with each other. This section serves to document behaviour around the AMQP payloads sent and received by the client in relation to the various JMS Message types used, to aid in using the client along with other AMQP clients.

11.1.1. Sending messages

This section serves to document the different payloads sent by the client when using the various JMS Message types, so as to aid in using other clients to receive them.

11.1.1.1. Message type

JMS message typeDescription of transmitted AMQP message

TextMessage

A TextMessage will be sent using an amqp-value body section containing a utf8 encoded string of the body text, or null if no body text is set. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 5.

BytesMessage

A BytesMessage will be sent using a data body section containing the raw bytes from the BytesMessage body, with the properties section content-type field set to the symbol value “application/octet-stream”. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 3.

MapMessage

A MapMessage body will be sent using an amqp-value body section containing a single map value. Any byte[] values in the MapMessage body will be encoded as binary entries in the map. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 2.

StreamMessage

A StreamMessage will be sent using an amqp-sequence body section containing the entries in the StreamMessage body. Any byte[] entries in the StreamMessage body will be encoded as binary entries in the sequence. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 4.

ObjectMessage

An ObjectMessage will be sent using an data body section, containing the bytes from serializing the ObjectMessage body using an ObjectOutputStream, with the properties section content-type field set to the symbol value “application/x-java-serialized-object”. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 1.

Message

A plain JMS Message has no body, and will be sent as an amqp-value body section containing a null. The message annotation with symbol key of “x-opt-jms-msg-type” will be set to a byte value of 0.

11.1.1.2. Message properties

JMS messages support setting application properties of various Java types. This section serves to show the mapping of these property types to AMQP typed values in the application-properties section of the sent message. Both JMS and AMQP use string keys for property names.

JMS property typeAMQP application property type

boolean

boolean

byte

byte

short

short

int

int

long

long

float

float

double

double

String

string or null

11.1.2. Receiving messages

This section serves to document the different payloads received by the client will be mapped to the various JMS Message types, so as to aid in using other clients to send messages for receipt by the JMS client.

11.1.2.1. Message type

If the the “x-opt-jms-msg-type” message-annotation is present on the received AMQP message, its value is used to determine the JMS message type used to represent it, according to the mapping detailed in the following table. This reflects the reverse process of the mappings discussed for messages sent by the JMS client.

AMQP “x-opt-jms-msg-type” message-annotation value (type)JMS message type

0 (byte)

Message

1 (byte)

ObjectMessage

2 (byte)

MapMessage

3 (byte)

BytesMessage

4 (byte)

StreamMessage

5 (byte)

TextMessage

If the “x-opt-jms-msg-type” message-annotation is not present, the table below details how the message will be mapped to a JMS Message type. Note that the StreamMessage and MapMessage types are only assigned to annotated messages.

Description of Received AMQP Message without “x-opt-jms-msg-type” annotationJMS Message Type
  • An amqp-value body section containing a string or null.
  • A data body section, with the properties section content-type field set to a symbol value representing a common textual media type such as "text/plain", "application/xml", or "application/json”.

TextMessage

  • An amqp-value body section containing a binary.
  • A data body section, with the properties section content-type field either not set, set to symbol value "application/octet-stream”, or set to any value not understood to be associated with another message type.

BytesMessage

  • A data body section, with the properties section content-type field set to symbol value “application/x-java-serialized-object".
  • An amqp-value body section containing a value not covered above.
  • An amqp-sequence body section. This will be represented as a List inside the ObjectMessage.

ObjectMessage

11.1.2.2. Message properties

This section serves to show the mapping of values in the application-properties section of the received AMQP message to Java types used in the JMS Message.

AMQP application property TypeJMS property type

boolean

boolean

byte

byte

short

short

int

int

long

long

float

float

double

double

string

String

null

String

11.2. Connecting to AMQ Broker

AMQ Broker is designed to interoperate with AMQP 1.0 clients. Check the following to ensure the broker is configured for AMQP messaging:

  • Port 5672 in the network firewall is open.
  • The AMQ Broker AMQP acceptor is enabled. See Default acceptor settings.
  • The necessary addresses are configured on the broker. See Addresses, Queues, and Topics.
  • The broker is configured to permit access from your client, and the client is configured to send the required credentials. See Broker Security.

11.3. Connecting to AMQ Interconnect

AMQ Interconnect works with any AMQP 1.0 client. Check the following to ensure the components are configured correctly:

  • Port 5672 in the network firewall is open.
  • The router is configured to permit access from your client, and the client is configured to send the required credentials. See Securing network connections.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.