Menu Close
Settings Close

Language and Page Formatting Options

Red Hat Training

A Red Hat training course is available for Red Hat AMQ

Chapter 6. Interoperability

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

6.1. Interoperating with Other AMQP Clients

AMQP messages are composed using the AMQP type system. This common format is one of the reasons AMQP clients in different languages are able to interoperate with each other.

When sending messages, AMQ JavaScript automatically converts language-native types to AMQP-encoded data. When receiving messages, the reverse conversion takes place.

Note

More information about AMQP types is available at the interactive type reference maintained by the Apache Qpid project.

JavaScript has fewer native types than AMQP can encode. To send messages containing specific AMQP types, use the wrap_ functions from the rhea/types.js module.

Table 6.1. AMQ JavaScript and AMQP Types

AMQ JavaScript TypeAMQP TypeDescription

null

null

An empty value

boolean

boolean

A true or false value

string

string

A sequence of Unicode characters

wrap_binary(string)

binary

A sequence of bytes

wrap_byte(number)

byte

A signed 8-bit integer

wrap_short(number)

short

A signed 16-bit integer

wrap_int(number)

int

A signed 32-bit integer

wrap_long(number)

long

A signed 64-bit integer

wrap_ubyte(number)

ubyte

An unsigned 8-bit integer

wrap_ushort(number)

ushort

An unsigned 16-bit integer

wrap_uint(number)

uint

An unsigned 32-bit integer

wrap_ulong(number)

ulong

An unsigned 64-bit integer

wrap_float(number)

float

A 32-bit floating point number

wrap_double(number)

double

A 64-bit floating point number

wrap_array(Array, code)

array

A sequence of values of a single type

wrap_list(Array)

list

A sequence of values of variable type

wrap_map(object)

map

A mapping from distinct keys to values

wrap_symbol(string)

symbol

A 7-bit ASCII string from a constrained domain

wrap_timestamp(number)

timestamp

An absolute point in time

Table 6.2. AMQ JavaScript and Other AMQ Client Types

AMQ JavaScriptAMQ C++AMQ PythonAMQ .NET

null

nullptr

None

null

boolean

bool

bool

System.Boolean

string

std::string

unicode

System.String

wrap_binary(string)

proton::binary

bytes

System.Byte[]

wrap_byte(number)

int8_t

proton.byte

System.SByte

wrap_short(number)

int16_t

proton.short

System.Int16

wrap_int(number)

int32_t

proton.int32

System.Int32

wrap_long(number)

int64_t

long

System.Int64

wrap_ubyte(number)

uint8_t

proton.ubyte

System.Byte

wrap_ushort(number)

uint16_t

proton.ushort

System.UInt16

wrap_uint(number)

uint32_t

proton.uint

System.UInt32

wrap_ulong(number)

uint64_t

proton.ulong

System.UInt64

wrap_float(number)

float

proton.float32

System.Single

wrap_double(number)

double

float

System.Double

wrap_array(Array, code)

-

proton.Array

-

wrap_list(Array)

std::vector

list

Amqp.List

wrap_map(object)

std::map

dict

Amqp.Map

wrap_symbol(string)

proton::symbol

proton.symbol

Amqp.Symbol

wrap_timestamp(number)

proton::timestamp

proton.timestamp

System.DateTime

6.2. Interoperating with AMQ JMS

AMQP defines a standard mapping to the JMS messaging model. This section discusses the various aspects of that mapping. For more information, see the AMQ JMS Interoperability chapter.

JMS Message Types

AMQ JavaScript provides a single message type whose body type can vary. By contrast, the JMS API uses different message types to represent different kinds of data. The table below indicates how particular body types map to JMS message types.

For more explicit control of the resulting JMS message type, you can set the x-opt-jms-msg-type message annotation. See the AMQ JMS Interoperability chapter for more information.

Table 6.3. AMQ JavaScript and JMS Message Types

AMQ JavaScript Body TypeJMS Message Type

string

TextMessage

null

TextMessage

wrap_binary(string)

BytesMessage

Any other type

ObjectMessage

6.3. 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 Configuring Network Access.
  • 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.

6.4. 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 Interconnect Security.