From 5bee535ea193f5f5fd65d5fe0ebf30c825216d96 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 13 Jul 2010 15:32:41 +0000 Subject: QPID-2671 - Patch from Chuck Rolke Additional documentation for the .NET messaging API git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@963762 13f79535-47bb-0310-9956-ffa450edef68 --- doc/book/src/Programming-In-Apache-Qpid.xml | 126 +++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/doc/book/src/Programming-In-Apache-Qpid.xml b/doc/book/src/Programming-In-Apache-Qpid.xml index a5a846152c..931b7c15f2 100644 --- a/doc/book/src/Programming-In-Apache-Qpid.xml +++ b/doc/book/src/Programming-In-Apache-Qpid.xml @@ -275,7 +275,10 @@ finally: The following .NET C# program shows how to create a connection, create a session, send messages using a sender, and receive - messages using a receiver. + messages using a receiver. The .NET binding for the Qpid C++ Messaging API + applies to all .NET Framework managed code languages. C# was chosen + for illustration purposes only. + "Hello world!" in .NET C# @@ -1972,6 +1975,127 @@ sender.send(message, true); +
+ Qpid Maps in .NET + + + + The .NET binding for the Qpid Messaging API binds .NET managed data types + to C++ Variant data types. The following code shows how to + send Map and List structures in a message: + + + + Sending Qpid Maps in .NET C# + content = new Dictionary(); +Dictionary subMap = new Dictionary(); +Collection colors = new Collection(); + +// add simple types +content["id"] = 987654321; +content["name"] = "Widget"; +content["percent"] = 0.99; + +// add nested amqp/map +subMap["name"] = "Smith"; +subMap["number"] = 354; +content["nestedMap"] = subMap; + +// add an amqp/list +colors.Add("red"); +colors.Add("green"); +colors.Add("white"); +content["colorsList"] = colors; + +// add one of each supported amqp data type +bool mybool = true; +content["mybool"] = mybool; + +byte mybyte = 4; +content["mybyte"] = mybyte; + +UInt16 myUInt16 = 5; +content["myUInt16"] = myUInt16; + +UInt32 myUInt32 = 6; +content["myUInt32"] = myUInt32; + +UInt64 myUInt64 = 7; +content["myUInt64"] = myUInt64; + +char mychar = 'h'; +content["mychar"] = mychar; + +Int16 myInt16 = 9; +content["myInt16"] = myInt16; + +Int32 myInt32 = 10; +content["myInt32"] = myInt32; + +Int64 myInt64 = 11; +content["myInt64"] = myInt64; + +Single mySingle = (Single)12.12; +content["mySingle"] = mySingle; + +Double myDouble = 13.13; +content["myDouble"] = myDouble; + +Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f"); +content["myGuid"] = myGuid; + +Message message = new Message(content); +Send(message, true); +]]> + + + + The following table shows the mapping between datatypes in .NET and C++. + + + + Datatype Mapping between C++ and .NET binding + + + + C++ Datatype + → .NET binding + + + + boolbool + uint8byte + uint16UInt16 + uint32UInt32 + uint64UInt64 + uint8char + int16Int16 + int32Int32 + int64Int64 + floatSingle + doubleDouble + stringstring + qpid::types::UuidGuid + Variant::Map]]> + Variant::List]]> + + +
+ + + + Strings are currently interpreted only with UTF-8 encoding. + + + + + -- cgit v1.2.1