Questo contenuto non è disponibile nella lingua selezionata.

Chapter 12. Interoperability


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

12.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, Red Hat build of Rhea 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.

Table 12.1. AMQP types
AMQP typeDescription

null

An empty value

boolean

A true or false value

char

A single Unicode character

string

A sequence of Unicode characters

binary

A sequence of bytes

byte

A signed 8-bit integer

short

A signed 16-bit integer

int

A signed 32-bit integer

long

A signed 64-bit integer

ubyte

An unsigned 8-bit integer

ushort

An unsigned 16-bit integer

uint

An unsigned 32-bit integer

ulong

An unsigned 64-bit integer

float

A 32-bit floating point number

double

A 64-bit floating point number

array

A sequence of values of a single type

list

A sequence of values of variable type

map

A mapping from distinct keys to values

uuid

A universally unique identifier

symbol

A 7-bit ASCII string from a constrained domain

timestamp

An absolute point in time

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 12.2. Rhea types before encoding and after decoding
AMQP typeRhea type before encodingRhea type after decoding

null

null

null

boolean

boolean

boolean

char

wrap_char(number)

number

string

string

string

binary

wrap_binary(string)

string

byte

wrap_byte(number)

number

short

wrap_short(number)

number

int

wrap_int(number)

number

long

wrap_long(number)

number

ubyte

wrap_ubyte(number)

number

ushort

wrap_ushort(number)

number

uint

wrap_uint(number)

number

ulong

wrap_ulong(number)

number

float

wrap_float(number)

number

double

wrap_double(number)

number

array

wrap_array(Array, code)

Array

list

wrap_list(Array)

Array

map

wrap_map(object)

object

uuid

wrap_uuid(number)

number

symbol

wrap_symbol(string)

string

timestamp

wrap_timestamp(number)

number

Table 12.3. Rhea and other AMQ client types (1 of 2)
Rhea type before encodingAMQ C++ typeRed Hat build of Apache Qpid Proton DotNet type

null

nullptr

null

boolean

bool

System.Boolean

wrap_char(number)

wchar_t

System.Char

string

std::string

System.String

wrap_binary(string)

proton::binary

System.Byte[]

wrap_byte(number)

int8_t

System.SByte

wrap_short(number)

int16_t

System.Int16

wrap_int(number)

int32_t

System.Int32

wrap_long(number)

int64_t

System.Int64

wrap_ubyte(number)

uint8_t

System.Byte

wrap_ushort(number)

uint16_t

System.UInt16

wrap_uint(number)

uint32_t

System.UInt32

wrap_ulong(number)

uint64_t

System.UInt64

wrap_float(number)

float

System.Single

wrap_double(number)

double

System.Double

wrap_array(Array, code)

-

-

wrap_list(Array)

std::vector

Amqp.List

wrap_map(object)

std::map

Amqp.Map

wrap_uuid(number)

proton::uuid

System.Guid

wrap_symbol(string)

proton::symbol

Amqp.Symbol

wrap_timestamp(number)

proton::timestamp

System.DateTime

Table 12.4. Rhea and other AMQ client types (2 of 2)
Rhea type before encodingRed Hat build of Apache Qpid Proton Python type 

null

None

 

boolean

bool

 

string

unicode

 

wrap_char(number)

unicode

 

wrap_binary(string)

bytes

 

wrap_byte(number)

int

 

wrap_short(number)

int

 

wrap_int(number)

long

 

wrap_long(number)

long

 

wrap_ubyte(number)

long

 

wrap_ushort(number)

long

 

wrap_uint(number)

long

 

wrap_ulong(number)

long

 

wrap_float(number)

float

 

wrap_double(number)

float

 

wrap_array(Array, code)

proton.Array

 

wrap_list(Array)

list

 

wrap_map(object)

dict

 

wrap_uuid(number)

-

 

wrap_symbol(string)

str

 

wrap_timestamp(number)

long

 

12.2. Interoperating with Red Hat build of Apache Qpid 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 Red Hat build of Apache Qpid JMS Interoperability chapter.

JMS message types

Red Hat build of Rhea 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 Red Hat build of Apache Qpid JMS Interoperability chapter for more information.

Table 12.5. Rhea and JMS message types
Rhea body typeJMS message type

string

TextMessage

null

TextMessage

wrap_binary(string)

BytesMessage

Any other type

ObjectMessage

12.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 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.
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.