이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 10. 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.

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

Table 10.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 10.2. AMQ JavaScript types before encoding and after decoding
AMQP typeAMQ JavaScript type before encodingAMQ JavaScript 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 10.3. AMQ JavaScript and other AMQ client types (1 of 2)
AMQ JavaScript type before encodingAMQ C++ typeAMQ .NET 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 10.4. AMQ JavaScript and other AMQ client types (2 of 2)
AMQ JavaScript type before encodingAMQ Python typeAMQ Ruby type

null

None

nil

boolean

bool

true, false

wrap_char(number)

unicode

String

string

unicode

String

wrap_binary(string)

bytes

String

wrap_byte(number)

int

Integer

wrap_short(number)

int

Integer

wrap_int(number)

long

Integer

wrap_long(number)

long

Integer

wrap_ubyte(number)

long

Integer

wrap_ushort(number)

long

Integer

wrap_uint(number)

long

Integer

wrap_ulong(number)

long

Integer

wrap_float(number)

float

Float

wrap_double(number)

float

Float

wrap_array(Array, code)

proton.Array

Array

wrap_list(Array)

list

Array

wrap_map(object)

dict

Hash

wrap_uuid(number)

-

-

wrap_symbol(string)

str

Symbol

wrap_timestamp(number)

long

Time

10.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 10.5. AMQ JavaScript and JMS message types
AMQ JavaScript body typeJMS message type

string

TextMessage

null

TextMessage

wrap_binary(string)

BytesMessage

Any other type

ObjectMessage

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

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

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.