Questo contenuto non è disponibile nella lingua selezionata.
Chapter 11. Interoperability
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 type | Description of transmitted AMQP message |
---|---|
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. | |
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. | |
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. | |
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. | |
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. | |
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 type | AMQP application property type |
---|---|
boolean | |
byte | |
short | |
int | |
long | |
float | |
double | |
String |
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) | |
1 (byte) | |
2 (byte) | |
3 (byte) | |
4 (byte) | |
5 (byte) |
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” annotation | JMS Message Type |
---|---|
| |
| |
|
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 Type | JMS property type |
---|---|
boolean | |
byte | |
short | |
int | |
long | |
float | |
double | |
String | |
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.