From 7f4c5ec7b14d3b341bc3e3054ef70a618652efcb Mon Sep 17 00:00:00 2001 From: Jonathan Robie Date: Fri, 7 May 2010 15:26:01 +0000 Subject: First draft on map messages is now complete. Modified formatting to make PDF come out better, changed to a separate book in order to get a list of examples and a list of tables. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@942125 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/doc/book/src/Programming-In-Apache-Qpid.xml | 149 +++++++++++++---------- 1 file changed, 84 insertions(+), 65 deletions(-) diff --git a/qpid/doc/book/src/Programming-In-Apache-Qpid.xml b/qpid/doc/book/src/Programming-In-Apache-Qpid.xml index a8b552617b..d0abec1266 100644 --- a/qpid/doc/book/src/Programming-In-Apache-Qpid.xml +++ b/qpid/doc/book/src/Programming-In-Apache-Qpid.xml @@ -1,5 +1,5 @@ - -
+ Programming in Apache Qpid Cross-Platform AMQP Messaging in Java JMS, .NET, C++, and Python -
- Supported APIs + + Introduction Apache Qpid is a reliable, asynchronous messaging system that supports the AMQP messaging protocol in several common programming @@ -65,9 +65,9 @@ -
+ -
+ Using the Qpid Messaging API The Qpid Messaging API is quite simple, consisting of only a @@ -232,7 +232,7 @@ finally: An address resolves to a node. The Qpid Messaging API recognises two kinds of nodes, - queues and topics. + queues and topics The terms queue and topic here were chosen to align with @@ -758,10 +758,13 @@ Message(properties={spout-id:ea75d64d-ea37-47f9-96a9-d38e01c97925:0}, content='t TODO: Add some reliability option examples --> - +
Address String Options + + + option value @@ -856,10 +859,13 @@ Message(properties={spout-id:ea75d64d-ea37-47f9-96a9-d38e01c97925:0}, content='t
- +
Node Properties + + + property value @@ -920,7 +926,10 @@ Message(properties={spout-id:ea75d64d-ea37-47f9-96a9-d38e01c97925:0}, content='t exchange: , queue: , key: , - arguments: { : , ..., : } + arguments: { + : , + ..., + : } }, ... ] @@ -938,10 +947,13 @@ Message(properties={spout-id:ea75d64d-ea37-47f9-96a9-d38e01c97925:0}, content='t
- + Link Properties + + + option value @@ -1119,7 +1131,7 @@ options := map
Logging -########### +
Logging in C++ The Qpidd broker and C++ clients can both use environment @@ -1200,10 +1212,13 @@ try: The following table lists the connection options that can be used. -
+
Connection Options + + + option value @@ -1386,7 +1401,7 @@ std::cout << request.getContent() << " -> " << response.getContent() << std::end -->
- Maps in Messages + Maps in Message Content Many messaging applications need to exchange data across languages and platforms, using the native datatypes of each @@ -1394,53 +1409,51 @@ std::cout << request.getContent() << " -> " << response.getContent() << std::end but does not directly support a set of named type/value pairs. Java JMS provides the MapMessage interface, which allows sets of named type/value pairs, but does - not provide a set of portable datatypes. The Qpid Messaging API - supports maps, analogous to Java JMS - MapMessage, using the datatypes that are - most convenient in each language. For simple datatypes, it - simply uses the equivalent datatype in each language. For - complex datatypes, it follows the conventions of each language. + not provide a set of portable datatypes. + + The Qpid Messaging API supports maps in message + content. Unlike JMS, any message can contain maps. These maps + are supported in each language using the conventions of the + language. In Java, we implement the + MapMessage interface; in Python, we + support dict and + list in message content; in C++, we + provide the Variant::Map and + Variant::List classes to represent maps + and lists. In all languages, messages are encoded using AMQP's + portable datatypes.
Qpid Maps in Python - In Python, Qpid supports the dict and list types directly in message content. + In Python, Qpid supports the dict and list types directly in message content. The following code shows how to send these structures in a message: Sending Qpid Maps in Python The following table shows the datatypes that can be sent in a Python map message, - and the corresponding datatypes that will be received by clients in or . + and the corresponding datatypes that will be received by clients in Java or C++. -
+
Python Datatypes in Maps @@ -1471,16 +1484,17 @@ connection.close()
- ### C++ ### + Qpid Maps in C++ + + + In C++, Qpid defines the the + Variant::Map and + Variant::List types, which can be + encoded into message content. The following code shows how to + send these structures in a message: - The following table shows the datatypes that can be sent - in a C++ map message, and the corresponding datatypes that - will be received by clients in #### or . - - + Sending Qpid Maps in C++ + The following table shows the datatypes that can be sent + in a C++ map message, and the corresponding datatypes that + will be received by clients in Java and Python. +
C++ Datatypes in Maps @@ -1956,10 +1974,13 @@ else dp refers to an AMQP 0-10 delivery-properties struct. -
+
Mapping to AMQP 0-10 Message Properties + + + Python API C++ API @@ -2004,10 +2025,10 @@ else
- + -
+ Using the Qpid JMS client
A Simple Messaging Program in Java JMS @@ -2208,7 +2229,7 @@ destination.topicExchange = amq.topic Apache Qpid supports the following properties in Connection URLs: - +
Connection URL Properties @@ -2329,7 +2350,7 @@ amqp://guest:guest@test/test?sync_ack='true' The following broker list options are supported. -
+
Broker List Options @@ -2521,7 +2542,7 @@ amqp://guest:guest@test/test?sync_ack='true' dp refers to an AMQP 0-10 delivery-properties struct. -
+
Java JMS Mapping to AMQP 0-10 Message Properties @@ -2574,12 +2595,10 @@ amqp://guest:guest@test/test?sync_ack='true'
JMS MapMessage Types - Qpid supports the Java JMS MapMessage interface, which provides support for maps in messages. - - + Qpid supports the Java JMS MapMessage interface, which provides support for maps in messages. The following code shows how to send a MapMessage in Java JMS. - Map Messages in Java JMS + Sending a Java JMS MapMessage - - The following table shows the datatypes that can be sent in a MapMessage, and the corresponding datatypes that will be received by clients in or . + + The following table shows the datatypes that can be sent in a MapMessage, and the corresponding datatypes that will be received by clients in Python or C++.
Java Datatypes in Maps @@ -2764,8 +2783,8 @@ variable := ( | )]]> - - + +