[rabbitmq-discuss] R: regarding SimpleAmqpClient

Alan Antonuk alan.antonuk at gmail.com
Mon Mar 12 14:39:52 GMT 2012


If all you want to do is put an array of characters into a BasicMessage you
can do so using the string constructor:

char *myData;
size_t myDataLength;
BasicMessage::Create(std::string(myData, myDataLength));

And yes it will deal with embedded null's correctly.

If you're dead-set on using the other function (it really is meant as an
internal function) you can #include <amqp_framing.h> (from rabbitmq-c) and
use a amqp_basic_properties_t struct.  If you zero it out (using memset),
that is sufficient to make it work correctly (you'll get a BasicMessage
with no properties set).

-Alan

On Mon, Mar 12, 2012 at 8:33 AM, Lorenzo Rossi
<l.rossi.cons at vitrociset.it>wrote:

>  Another question:****
>
> I need to transmit raw data (an array of char) through Rabbit. The
> following function:****
>
> **-   **static ptr_t Create(amqp_bytes_t_& body,
> amqp_basic_properties_t_* properties) ****
>
> inserts a byte array struct, but an amqp_basic_properties_t_ is also
> needed, and I don’t know how to fill that structure. Any clues?****
>
> ** **
>
> Best,****
>
> ** **
>
> Lorenzo****
>
> ** **
>
> Lorenzo Rossi****
>
> _________________________________________****
>
> Vitrociset S.p.A.****
>
> Via Tiburtina, 1020 - 00156 Roma - Italia****
>
> +39 06 8820 3047****
>
> ** **
>
> Questa e-mail ed ogni suo allegato sono confidenziali. Se li aveste
> ricevuti per errore, vogliate cortesemente darcene comunicazione subito e
> distruggere il messaggio ricevuto erroneamente dal Vostro sistema
> informatizzato. Per piacere non li utilizzate per nessun fine, o
> diffondete  il loro contenuto a nessun altra persona: fare ciò comporta
> violare le regole sulla privacy si cui al D. L.vo n. 196 /2003. Grazie
> per la cooperazione.****
>
> *This e-mail and any attachment are confidential. If you have received
> them in error, you are on notice of their status.  Please notify us
> immediately by replying e-mail and then delete this message from your
> system.  Please do not copy or use them for any purposes, or disclose their
> contents to any other person:  to do so could be a breach of the Italian
> Privacy D. L.vo 196/2003. **Thank you for your co-operation*
>
> ** **
>
> *Da:* Alan Antonuk [mailto:alan.antonuk at gmail.com]
> *Inviato:* giovedì 8 marzo 2012 18:00
>
> *A:* Lorenzo Rossi
> *Cc:* rabbitmq-discuss at lists.rabbitmq.com
> *Oggetto:* Re: [rabbitmq-discuss] regarding SimpleAmqpClient****
>
>  ** **
>
> I recently reworked the internals of the library (thus the v2.0-beta tag)
> and have not updated the code in the examples/ directory yet.****
>
> ** **
>
> So you are correct simple_connect.cpp is broken currently.****
>
> ** **
>
> To clarify: It is safe and reliable to have more than one consumer per
> AmqpClient::Channel object.****
>
> ** **
>
> -Alan****
>
> On Thu, Mar 8, 2012 at 11:37 AM, Lorenzo Rossi <l.rossi.cons at vitrociset.it>
> wrote:****
>
> Dear expert, ****
>
> As I told you yesterday I’m working on a C++ application who uses
> RabbitMQ. I have a simple question for you: related to Channel.h, function
> BasicConsume() I read in the function comments****
>
> “Note: due to a limitation to how things are done, it is only possible to
> reliably have a single consumer per channel, calling this more than once
> per channel may result in undefined results from BasicConsumeMessage”****
>
> Is it something related only on the C++ implementation? ****
>
>  ****
>
> Last but not least, I think there are some mistakes in the example
> simple_connect.cpp****
>
>  ****
>
> 1.      #include <SimpleAmqpClient.h> should be #include <
> SimpleAmqpClient/SimpleAmqpClient.h> since the installation procedure
> copies that file in the SimpleAmqpClient folder;****
>
> 2.      BasicMessage::ptr_t msg_out = channel->BasicConsumeMessage();
> doesn’t work for two reasons:****
>
> a.      A function BasicConsumeMessage() which takes no argument doesn’t
> exist in Channel.h;****
>
> b.      The function BasicConsumeMessage(…) currently defined in
> Channel.h returns a Envelope::ptr_t, not a BasicMessage::ptr_t. ****
>
> 3.      Header file SimpleAmqpClient.h includes unistd.h which is a POSIX
> header. I had to comment that row in order to make things work in Visual
> Studio 2008. ****
>
>  ****
>
>  ****
>
> Best wishes,****
>
>  ****
>
> Lorenzo****
>
>  ****
>
>  ****
>
>  ****
>
>  ****
>
> Lorenzo Rossi****
>
> _________________________________________****
>
> Vitrociset S.p.A.****
>
> Via Tiburtina, 1020 - 00156 Roma - Italia****
>
> +39 06 8820 3047****
>
>  ****
>
> Questa e-mail ed ogni suo allegato sono confidenziali. Se li aveste
> ricevuti per errore, vogliate cortesemente darcene comunicazione subito e
> distruggere il messaggio ricevuto erroneamente dal Vostro sistema
> informatizzato. Per piacere non li utilizzate per nessun fine, o
> diffondete  il loro contenuto a nessun altra persona: fare ciò comporta
> violare le regole sulla privacy si cui al D. L.vo n. 196 /2003. Grazie
> per la cooperazione.****
>
> *This e-mail and any attachment are confidential. If you have received
> them in error, you are on notice of their status.  Please notify us
> immediately by replying e-mail and then delete this message from your
> system.  Please do not copy or use them for any purposes, or disclose their
> contents to any other person:  to do so could be a breach of the Italian
> Privacy D. L.vo 196/2003. **Thank you for your co-operation*****
>
>  ****
>
> *Da:* Alan Antonuk [mailto:alan.antonuk at gmail.com]
> *Inviato:* martedì 6 marzo 2012 17:23
> *A:* Lorenzo Rossi
> *Cc:* rabbitmq-discuss at lists.rabbitmq.com
> *Oggetto:* Re: [rabbitmq-discuss] how to build SimpleAmqpClient?****
>
>  ****
>
> Did you build boost as a set of static libraries?  If so you'll need to
> set the Boost_USE_STATIC_LIBS=ON CMake variable.****
>
>  ****
>
> Another note: given you're building with VS2008 you're going to run into a
> different problem once you get past the boost library issue you're having:
> see this  https://github.com/alanxz/SimpleAmqpClient/issues/1 for what
> the issue is and a workaround.****
>
>  ****
>
> -Alan****
>
> On Tue, Mar 6, 2012 at 9:43 AM, Lorenzo Rossi <l.rossi.cons at vitrociset.it>
> wrote:****
>
> Dear Experts,****
>
> I’m trying to build SimpleAmqpClient (v2.0-beta-2) in Windows (VS 2008),
> but when I execute CMake, there are errors regarding boost:****
>
>  ****
>
> CMake Error at C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1128 (message):****
>
> Unable to find the requested Boost libraries.****
>
> Boost version: 1.48.0****
>
> Boost include path: C:/Applicazioni/boost****
>
> The following Boost libraries could not be found:****
>
> boost_chrono****
>
> boost_system****
>
> No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
> ****
>
> directory containing Boost libraries or BOOST_ROOT to the location of****
>
> Boost.****
>
> Call Stack (most recent call first):****
>
> CMakeLists.txt:8 (FIND_PACKAGE)****
>
>  ****
>
> I add manually the filepath for chrono and system to
> Boost_Chrono_Library_Debug, Boost_Chrono_Library_Release,
> Boost_System_Library_Debug, Boost_ System_Library_Release, but still it
> doesn’t find anything. I also create the BOOST_ROOT but still it doesn’t
> work.****
>
> Any suggestion?****
>
>
> Best,****
>
>
> Lorenzo****
>
>  ****
>
>  ****
>
> Lorenzo Rossi****
>
> _________________________________________****
>
> Vitrociset S.p.A.****
>
> Via Tiburtina, 1020 - 00156 Roma - Italia****
>
> +39 06 8820 3047****
>
>  ****
>
> Questa e-mail ed ogni suo allegato sono confidenziali. Se li aveste
> ricevuti per errore, vogliate cortesemente darcene comunicazione subito e
> distruggere il messaggio ricevuto erroneamente dal Vostro sistema
> informatizzato. Per piacere non li utilizzate per nessun fine, o
> diffondete  il loro contenuto a nessun altra persona: fare ciò comporta
> violare le regole sulla privacy si cui al D. L.vo n. 196 /2003. Grazie
> per la cooperazione.****
>
> *This e-mail and any attachment are confidential. If you have received
> them in error, you are on notice of their status.  Please notify us
> immediately by replying e-mail and then delete this message from your
> system.  Please do not copy or use them for any purposes, or disclose their
> contents to any other person:  to do so could be a breach of the Italian
> Privacy D. L.vo 196/2003. **Thank you for your co-operation*****
>
>  ****
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss****
>
>  ****
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss****
>
> ** **
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120312/95f4a60c/attachment.htm>


More information about the rabbitmq-discuss mailing list