You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Virgilio Alexandre Fornazin <vi...@gmail.com> on 2011/10/06 13:43:27 UTC

encode/decode methods in C# client api

Hi all

 

There are encode/decode methods in C++ qpid messaging api, but I can’t found
a C# counterpart.

I’m using qpid-0.10 messaging api. 

 

I need to send messages from a C# client to another already done C++
application (that uses encode/

decode calls). How I can do this?

 

Below there´s the methods

 

/**

 * Decodes message content into a Variant::Map.

 * 

 * @param message the message whose content should be decoded

 * @param map the map into which the message contents will be decoded

 * @param encoding if specified, the encoding to use - this overrides

 * any encoding specified by the content-type of the message

 * @exception EncodingException

 */

QPID_MESSAGING_EXTERN void decode(const Message& message,

                               qpid::types::Variant::Map& map,

                               const std::string& encoding = std::string());

/**

 * Decodes message content into a Variant::List.

 * 

 * @param message the message whose content should be decoded

 * @param list the list into which the message contents will be decoded

 * @param encoding if specified, the encoding to use - this overrides

 * any encoding specified by the content-type of the message

 * @exception EncodingException

 */

QPID_MESSAGING_EXTERN void decode(const Message& message,

                               qpid::types::Variant::List& list,

                               const std::string& encoding = std::string());

/**

 * Encodes a Variant::Map into a message.

 * 

 * @param map the map to be encoded

 * @param message the message whose content should be set to the encoded map

 * @param encoding if specified, the encoding to use - this overrides

 * any encoding specified by the content-type of the message

 * @exception EncodingException

 */

QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map& map,

                               Message& message,

                               const std::string& encoding = std::string());

/**

 * Encodes a Variant::List into a message.

 * 

 * @param list the list to be encoded

 * @param message the message whose content should be set to the encoded
list

 * @param encoding if specified, the encoding to use - this overrides

 * any encoding specified by the content-type of the message

 * @exception EncodingException

 */

QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List& list,

                               Message& message,

                               const std::string& encoding = std::string());

 


Re: encode/decode methods in C# client api

Posted by Chuck Rolke <cr...@redhat.com>.
For C# you can use the .NET Binding.

A Variant::Map is represented in .NET as Dictionary<string, object> and
a Variant::List is represented in .NET as Collection<object>.

The encode and decode functions are called for you as the binding creates messages.
This is exposed in examples cpp\bindings\qpid\dotnet\examples\csharp.map.sender
and cpp\bindings\qpid\dotnet\examples\csharp.map.receiver.

To build the .NET binding you must have the BOOST_ROOT used to build qpid\cpp in your path, and have QPID_BUILD_ROOT defined to be the directory in which cmake ran as it built the qpid-cpp.sln file.

Regards,
Chuck

----- Original Message -----
> From: "Virgilio Alexandre Fornazin" <vi...@gmail.com>
> To: users@qpid.apache.org
> Sent: Thursday, October 6, 2011 7:43:27 AM
> Subject: encode/decode methods in C# client api
> 
> Hi all
> 
>  
> 
> There are encode/decode methods in C++ qpid messaging api, but I
> can’t found
> a C# counterpart.
> 
> I’m using qpid-0.10 messaging api.
> 
>  
> 
> I need to send messages from a C# client to another already done C++
> application (that uses encode/
> 
> decode calls). How I can do this?
> 
>  
> 
> Below there´s the methods
> 
>  
> 
> /**
> 
>  * Decodes message content into a Variant::Map.
> 
>  *
> 
>  * @param message the message whose content should be decoded
> 
>  * @param map the map into which the message contents will be decoded
> 
>  * @param encoding if specified, the encoding to use - this overrides
> 
>  * any encoding specified by the content-type of the message
> 
>  * @exception EncodingException
> 
>  */
> 
> QPID_MESSAGING_EXTERN void decode(const Message& message,
> 
>                                qpid::types::Variant::Map& map,
> 
>                                const std::string& encoding =
>                                std::string());
> 
> /**
> 
>  * Decodes message content into a Variant::List.
> 
>  *
> 
>  * @param message the message whose content should be decoded
> 
>  * @param list the list into which the message contents will be
>  decoded
> 
>  * @param encoding if specified, the encoding to use - this overrides
> 
>  * any encoding specified by the content-type of the message
> 
>  * @exception EncodingException
> 
>  */
> 
> QPID_MESSAGING_EXTERN void decode(const Message& message,
> 
>                                qpid::types::Variant::List& list,
> 
>                                const std::string& encoding =
>                                std::string());
> 
> /**
> 
>  * Encodes a Variant::Map into a message.
> 
>  *
> 
>  * @param map the map to be encoded
> 
>  * @param message the message whose content should be set to the
>  encoded map
> 
>  * @param encoding if specified, the encoding to use - this overrides
> 
>  * any encoding specified by the content-type of the message
> 
>  * @exception EncodingException
> 
>  */
> 
> QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map&
> map,
> 
>                                Message& message,
> 
>                                const std::string& encoding =
>                                std::string());
> 
> /**
> 
>  * Encodes a Variant::List into a message.
> 
>  *
> 
>  * @param list the list to be encoded
> 
>  * @param message the message whose content should be set to the
>  encoded
> list
> 
>  * @param encoding if specified, the encoding to use - this overrides
> 
>  * any encoding specified by the content-type of the message
> 
>  * @exception EncodingException
> 
>  */
> 
> QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List&
> list,
> 
>                                Message& message,
> 
>                                const std::string& encoding =
>                                std::string());
> 
>  
> 
> 

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org