qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Rolke <cro...@redhat.com>
Subject Re: Is there compelte API reference and How serialize byte array like int array[n]
Date Sun, 01 Apr 2012 14:15:40 GMT
Hi,

The http://qpid.apache.org/books/0.14/Programming-In-Apache-Qpid/html/index.html guide describes
what you are trying to do. Take a look at the the ::List type. As implemented by Qpid the
List type maps an array into a single AMQP message object. For example you can send a single
int in a message and the AMQP encoding will be <int:value>. Or you can send an array
of int as a list encoded as <list: type=int, size=n, value, value, value...>. Using
this strategy is a good idea as your receiver will receive the array without any explicit
packing, unpacking, or byte swapping. Again, the Programming-In document describes this.

You can deal with messages using raw bytes as easily as with using strings. See paste from
Message.h below. With this method you can send arbitrary blocks of binary data no problem.

Regards,
Chuck


    /**
     * Set the content to the data held in the string parameter. Note:
     * this is treated as raw bytes and need not be text. Consider
     * setting the content-type to indicate how the data should be
     * interpreted by recipients.
     */
    QPID_MESSAGING_EXTERN void setContent(const std::string&);
    /**
     * Copy count bytes from the region pointed to by chars as the
     * message content.
     */
    QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count);

    /** Get the content as a std::string */
    QPID_MESSAGING_EXTERN std::string getContent() const;
    /**
     * Get a const pointer to the start of the content data. The
     * memory pointed to is owned by the message. The getContentSize()
     * method indicates how much data there is (i.e. the extent of the
     * memory region pointed to by the return value of this method).
     */
    QPID_MESSAGING_EXTERN const char* getContentPtr() const;
    /** Get the size of content in bytes. */
    QPID_MESSAGING_EXTERN size_t getContentSize() const;



----- Original Message -----
> From: "Zhihua Che" <zhihua.che@gmail.com>
> To: "users" <users@qpid.apache.org>
> Sent: Sunday, April 1, 2012 6:10:37 AM
> Subject: Is there compelte API reference and How serialize byte array like int array[n]
> 
> Hi, everyone
> 
>     I'm using qpid to transfer binary data. I find that Variant is
> designed for this purpose. But I also find that it only can serialize
> character string.
>     I wonder if there is straight way to serialize byte stream.
> 
>    By the way, Is there complete API reference available? The
> documents I find are just tutorial and I wonder if I can learn more
> APIs or details about qpid from somewhere.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message