搜索

此内容没有您所选择的语言版本。

Chapter 14. Interoperability

download PDF

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

14.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 C++ 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 14.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 14.2. AMQ C++ types before encoding and after decoding
AMQP typeAMQ C++ type before encodingAMQ C++ type after decoding

null

nullptr

nullptr

boolean

bool

bool

char

wchar_t

wchar_t

string

std::string

std::string

binary

proton::binary

proton::binary

byte

int8_t

int8_t

short

int16_t

int16_t

int

int32_t

int32_t

long

int64_t

int64_t

ubyte

uint8_t

uint8_t

ushort

uint16_t

uint16_t

uint

uint32_t

uint32_t

ulong

uint64_t

uint64_t

float

float

float

double

double

double

list

std::vector

std::vector

map

std::map

std::map

uuid

proton::uuid

proton::uuid

symbol

proton::symbol

proton::symbol

timestamp

proton::timestamp

proton::timestamp

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

nullptr

null

null

bool

boolean

System.Boolean

wchar_t

number

System.Char

std::string

string

System.String

proton::binary

string

System.Byte[]

int8_t

number

System.SByte

int16_t

number

System.Int16

int32_t

number

System.Int32

int64_t

number

System.Int64

uint8_t

number

System.Byte

uint16_t

number

System.UInt16

uint32_t

number

System.UInt32

uint64_t

number

System.UInt64

float

number

System.Single

double

number

System.Double

std::vector

Array

Amqp.List

std::map

object

Amqp.Map

proton::uuid

number

System.Guid

proton::symbol

string

Amqp.Symbol

proton::timestamp

number

System.DateTime

Table 14.4. AMQ C++ and other AMQ client types (2 of 2)
AMQ C++ type before encodingAMQ Python typeAMQ Ruby type

nullptr

None

nil

bool

bool

true, false

wchar_t

unicode

String

std::string

unicode

String

proton::binary

bytes

String

int8_t

int

Integer

int16_t

int

Integer

int32_t

long

Integer

int64_t

long

Integer

uint8_t

long

Integer

uint16_t

long

Integer

uint32_t

long

Integer

uint64_t

long

Integer

float

float

Float

double

float

Float

std::vector

list

Array

std::map

dict

Hash

proton::uuid

-

-

proton::symbol

str

Symbol

proton::timestamp

long

Time

14.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 C++ 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 14.5. AMQ C++ and JMS message types
AMQ C++ body typeJMS message type

std::string

TextMessage

nullptr

TextMessage

proton::binary

BytesMessage

Any other type

ObjectMessage

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

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

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.