第12章 相互運用性

本章では、AMQ Python を他の AMQ コンポーネントと組み合わせて使用する方法を説明します。AMQ コンポーネントの互換性の概要は、製品の概要 を参照してください。

12.1. 他の AMQP クライアントとの相互運用

AMQP メッセージは AMQP タイプシステムを使用して設定されます。このような一般的な形式は、異なる言語の AMQP クライアントが相互に対話できる理由の 1 つです。

メッセージを送信する場合、AMQ Python は自動的に言語ネイティブの型を AMQP でエンコードされたデータに変換します。メッセージの受信時に、リバース変換が行われます。

注記

AMQP タイプの詳細は、Apache Qpid プロジェクトによって維持される インタラクティブタイプリファレンスを参照してください。

表12.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

絶対的な時点

表12.2 エンコード前およびデコード後における AMQ Python タイプ

AMQP 型エンコード前の AMQ Python タイプデコード後の AMQ Python タイプ

null

None

None

boolean

bool

bool

char

proton.char

unicode

string

unicode

unicode

binary

bytes

bytes

byte

proton.byte

int

short

proton.short

int

int

proton.int32

long

long

long

long

ubyte

proton.ubyte

long

ushort

proton.ushort

long

uint

proton.uint

long

ulong

proton.ulong

long

float

proton.float32

float

double

float

float

array

proton.Array

proton.Array

list

list

list

map

dict

dict

symbol

proton.symbol

str

timestamp

proton.timestamp

long

表12.3 AMQ Python およびその他の AMQ クライアントタイプ (1/2)

エンコード前の AMQ Python タイプAMQ C++ タイプAMQ JavaScript タイプ

None

nullptr

null

bool

bool

boolean

proton.char

wchar_t

number

unicode

std::string

string

bytes

proton::binary

string

proton.byte

int8_t

number

proton.short

int16_t

number

proton.int32

int32_t

number

long

int64_t

number

proton.ubyte

uint8_t

number

proton.ushort

uint16_t

number

proton.uint

uint32_t

number

proton.ulong

uint64_t

number

proton.float32

float

number

float

double

number

proton.Array

-

Array

list

std::vector

Array

dict

std::map

object

uuid.UUID

proton::uuid

number

proton.symbol

proton::symbol

string

proton.timestamp

proton::timestamp

number

表12.4 AMQ Python およびその他の AMQ クライアントタイプ (2/2)

エンコード前の AMQ Python タイプAMQ .NET タイプAMQ Ruby タイプ

None

null

nil

bool

System.Boolean

true, false

proton.char

System.Char

String

unicode

System.String

String

bytes

System.Byte[]

String

proton.byte

System.SByte

Integer

proton.short

System.Int16

Integer

proton.int32

System.Int32

Integer

long

System.Int64

Integer

proton.ubyte

System.Byte

Integer

proton.ushort

System.UInt16

Integer

proton.uint

System.UInt32

Integer

proton.ulong

System.UInt64

Integer

proton.float32

System.Single

Float

float

System.Double

Float

proton.Array

-

Array

list

Amqp.List

Array

dict

Amqp.Map

Hash

uuid.UUID

System.Guid

-

proton.symbol

Amqp.Symbol

Symbol

proton.timestamp

System.DateTime

Time