Pesquisar

Este conteúdo não está disponível no idioma selecionado.

Chapter 8. Interoperability

download PDF

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

8.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 Ruby 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 8.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

Table 8.2. AMQ Ruby types before encoding and after decoding
AMQP typeAMQ Ruby type before encodingAMQ Ruby type after decoding

null

nil

nil

boolean

true, false

true, false

char

-

String

string

String

String

binary

-

String

byte

-

Integer

short

-

Integer

int

-

Integer

long

Integer

Integer

ubyte

-

Integer

ushort

-

Integer

uint

-

Integer

ulong

-

Integer

float

-

Float

double

Float

Float

array

-

Array

list

Array

Array

map

Hash

Hash

symbol

Symbol

Symbol

timestamp

Date, Time

Time

Table 8.3. AMQ Ruby and other AMQ client types (1 of 2)
AMQ Ruby type before encodingAMQ C++ typeAMQ JavaScript type

nil

nullptr

null

true, false

bool

boolean

String

std::string

string

Integer

int64_t

number

Float

double

number

Array

std::vector

Array

Hash

std::map

object

Symbol

proton::symbol

string

Date, Time

proton::timestamp

number

Table 8.4. AMQ Ruby and other AMQ client types (2 of 2)
AMQ Ruby type before encodingAMQ .NET typeAMQ Python type

nil

null

None

true, false

System.Boolean

bool

String

System.String

unicode

Integer

System.Int64

long

Float

System.Double

float

Array

Amqp.List

list

Hash

Amqp.Map

dict

Symbol

Amqp.Symbol

str

Date, Time

System.DateTime

long

8.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 Ruby 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 8.5. AMQ Ruby and JMS message types
AMQ Ruby body typeJMS message type

String

TextMessage

nil

TextMessage

-

BytesMessage

Any other type

ObjectMessage

8.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.

8.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 Securing network connections.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.