Chapter 14. Interoperability
Chapter 14. Interoperability This chapter discusses how to use AMQ Python 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 Python 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 type Description 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 Python types before encoding and after decoding AMQP type AMQ Python type before encoding AMQ Python type after decoding 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 Table 14.3. AMQ Python and other AMQ client types (1 of 2) AMQ Python type before encoding AMQ C++ type AMQ JavaScript type 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 Table 14.4. AMQ Python and other AMQ client types (2 of 2) AMQ Python type before encoding AMQ .NET type AMQ Ruby type 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 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 Python 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 Python and JMS message types AMQ Python body type JMS message type unicode TextMessage None TextMessage bytes 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 .