搜索

第 10 章 互操作性

download PDF

本章讨论如何与其他 AMQ 组件结合使用 AMQ .NET。有关 AMQ 组件兼容性的概述,请参阅 产品简介

10.1. 与其他 AMQP 客户端互操作

AMQP 消息通过 AMQP 类型系统来 构成。这种常见格式是不同语言的 AMQP 客户端能够相互互操作的原因之一。

发送消息时,AMQ .NET 会自动将语言原生类型转换为 AMQP 编码的数据。接收消息时,会进行反向转换。

注意

有关 AMQP 类型的更多信息,请参阅 Apache Qpid 项目维护 的交互式类型参考

表 10.1. AMQP 类型
AMQP 类型描述

null

一个空值

boolean

true 或 false 值

char

单个 Unicode 字符

string

Unicode 字符序列

binary

字节序列

byte

签名的 8 位整数

short

签名的 16 位整数

int

签名的 32 位整数

long

签名的 64 位整数

ubyte

未签名的 8 位整数

ushort

未签名的 16 位整数

uint

未签名 32 位整数

ulong

未签名 64 位整数

float

32 位浮动点数

double

64 位浮动点数

array

单个类型值序列

list

变量类型的一系列值

map

从不同键到值的映射

uuid

通用唯一标识符

symbol

来自受限域的 7 位 ASCII 字符串

timestamp

绝对时间点

表 10.2. 编码之前和解码后 AMQ .NET 类型
AMQP 类型编码前 AMQ .NET 类型解码后 AMQ .NET 类型

null

null

null

boolean

System.Boolean

System.Boolean

char

System.Char

System.Char

string

System.String

System.String

binary

System.Byte[]

System.Byte[]

byte

System.SByte

System.SByte

short

System.Int16

System.Int16

int

System.Int32

System.Int32

long

System.Int64

System.Int64

ubyte

System.Byte

System.Byte

ushort

System.UInt16

System.UInt16

uint

System.UInt32

System.UInt32

ulong

System.UInt64

System.UInt64

float

System.Single

System.Single

double

System.Double

System.Double

list

Amqp.List

Amqp.List

map

Amqp.Map

Amqp.Map

uuid

System.Guid

System.Guid

symbol

Amqp.Symbol

Amqp.Symbol

timestamp

System.DateTime

System.DateTime

表 10.3. AMQ .NET 和其他 AMQ 客户端类型(2 中的 1 个)
编码前 AMQ .NET 类型AMQ C++ 类型AMQ JavaScript 类型

null

nullptr

null

System.Boolean

bool

boolean

System.Char

wchar_t

number

System.String

std::string

string

System.Byte[]

proton::binary

string

System.SByte

int8_t

number

System.Int16

int16_t

number

System.Int32

int32_t

number

System.Int64

int64_t

number

System.Byte

uint8_t

number

System.UInt16

uint16_t

number

System.UInt32

uint32_t

number

System.UInt64

uint64_t

number

System.Single

float

number

System.Double

double

number

Amqp.List

std::vector

Array

Amqp.Map

std::map

object

System.Guid

proton::uuid

number

Amqp.Symbol

proton::symbol

string

System.DateTime

proton::timestamp

number

表 10.4. AMQ .NET 和其他 AMQ 客户端类型(2 个)
编码前 AMQ .NET 类型AMQ Python 类型AMQ Ruby 类型

null

None

nil

System.Boolean

bool

true, false

System.Char

unicode

String

System.String

unicode

String

System.Byte[]

bytes

String

System.SByte

int

Integer

System.Int16

int

Integer

System.Int32

long

Integer

System.Int64

long

Integer

System.Byte

long

Integer

System.UInt16

long

Integer

System.UInt32

long

Integer

System.UInt64

long

Integer

System.Single

float

Float

System.Double

float

Float

Amqp.List

list

Array

Amqp.Map

dict

Hash

System.Guid

-

-

Amqp.Symbol

str

Symbol

System.DateTime

long

Time

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.