You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Steve Olson <ol...@sybase.com> on 2010/05/03 22:47:43 UTC

Send data row as message using Qpid client

Hello,

I'm must getting acquainted with qpid. Have read the AMQP spec (0-10)  
and the messaging tutorial from red hat. I'm wondering how to send/ 
receive a message containing one or more data rows from a database  
(multiple datatypes) -- the qpid client api documentation isn't  
especially clear (to me) on this point.

Any suggestions or sample code would be welcome!

Regards,
Steve

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


Re: First draft user docs on maps

Posted by guillaume <gu...@gmail.com>.
Is encoding usine pb Is faster than with map and qpid encode function ?
-- 
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Send-data-row-as-message-using-Qpid-client-tp5000112p5506844.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

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


Re: First draft user docs on maps

Posted by Gordon Sim <gs...@redhat.com>.
On 05/07/2010 09:35 PM, Jonathan Robie wrote:
> On 05/03/2010 05:21 PM, Steve Olson wrote:
>> Thanks everyone for the replies. It looks like the map interface could
>> do the job nicely. Is there some advantage to going another route?
>>
>> Note that it will not be known at compile time what the data row is
>> going to look like; it will be obtained from the database during
>> program execution. Ideally, I would like to send multiple rows in a
>> single message.
>
> I've added basic information on maps here:
>
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html
>
> For C++ and Python, read this part:
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html#section-Maps

In c++ the value of map entries are instances of qpid::types::Variant. 
There is no direct support for a single char in this class (and the 
corresponding rows in the table are incorrect).

I think it would make more sense to use the definitions of types as used 
in Variant.h for this table. The exact width of e.g. int is platform and 
compiler dependent.

> For Java, read this part:
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html#section-JMS-MapMessage
>
>
> Feedback would be extremely helpful - let me know what's clear and
> what's not, and what errors you find.


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


First draft user docs on maps (was: Send data row as message using Qpid client)

Posted by Jonathan Robie <jo...@redhat.com>.
On 05/03/2010 05:21 PM, Steve Olson wrote:
> Thanks everyone for the replies. It looks like the map interface could 
> do the job nicely. Is there some advantage to going another route?
>
> Note that it will not be known at compile time what the data row is 
> going to look like; it will be obtained from the database during 
> program execution. Ideally, I would like to send multiple rows in a 
> single message.

I've added basic information on maps here:

http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html

For C++ and Python, read this part:
http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html#section-Maps

For Java, read this part:
http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html#section-JMS-MapMessage

Feedback would be extremely helpful - let me know what's clear and 
what's not, and what errors you find.

Jonathan

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


Re: Send data row as message using Qpid client

Posted by Jonathan Robie <jo...@redhat.com>.
On 05/03/2010 05:21 PM, Steve Olson wrote:
> Thanks everyone for the replies. It looks like the map interface could 
> do the job nicely. Is there some advantage to going another route?
>
> Note that it will not be known at compile time what the data row is 
> going to look like; it will be obtained from the database during 
> program execution. Ideally, I would like to send multiple rows in a 
> single message.

I would use maps. They also work across languages and platforms, which 
can be a very important advantage.

Jonathan

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


Re: Send data row as message using Qpid client

Posted by Steve Olson <ol...@sybase.com>.
Thanks everyone for the replies. It looks like the map interface could  
do the job nicely. Is there some advantage to going another route?

Note that it will not be known at compile time what the data row is  
going to look like; it will be obtained from the database during  
program execution. Ideally, I would like to send multiple rows in a  
single message.

Regards,
Steve

On May 3, 2010, at May 3, 2010  5:15 PM, Birdsall, Dave wrote:

> Hi,
>
> Another possibility for sending data rows over Qpid is to use some  
> serialization layer on top of Qpid, e.g. Google protocol buffers.
>
> Regards,
>
> Dave
>
> -----Original Message-----
> From: Donohue, Matt [mailto:mdonohue@structure-tech.com]
> Sent: Monday, May 03, 2010 2:13 PM
> To: users@qpid.apache.org
> Subject: RE: Send data row as message using Qpid client
>
> I assume you are using Red Hat Messaging?
> If you install the rpm rhm-docs it will install an examples  
> directory for each language in /usr/share/doc/rhm-0.5.
>
> Regards,
> matt
>
> -----Original Message-----
> From: Steve Olson [mailto:olson@sybase.com]
> Sent: Monday, May 03, 2010 4:06 PM
> To: users@qpid.apache.org
> Subject: Re: Send data row as message using Qpid client
>
> Thanks for the quick reply. I'll check out the link.
>
> Am programming in C/C++.
>
> Regards,
> Steve
>
> On May 3, 2010, at May 3, 2010  5:02 PM, Jonathan Robie wrote:
>
>> On 05/03/2010 04:47 PM, Steve Olson wrote:
>>> Hello,
>>>
>>> I'm must getting acquainted with qpid. Have read the AMQP spec
>>> (0-10) and the messaging tutorial from red hat. I'm wondering how
>>> to send/receive a message containing one or more data rows from a
>>> database (multiple datatypes) -- the qpid client api documentation
>>> isn't especially clear (to me) on this point.
>>
>> If you can, I'd use the new Qpid Messaging API, shown here:
>>
>> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html
>>
>> What language are you programming in? You can find a map message
>> example in C++ here:
>>
>> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_receiver.cpp
>> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_sender.cpp
>>
>> I will soon add examples in C++ and Python to Programming in Apache
>> Qpid.
>>
>> Jonathan
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


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


RE: Send data row as message using Qpid client

Posted by "Birdsall, Dave" <da...@hp.com>.
Hi,

Another possibility for sending data rows over Qpid is to use some serialization layer on top of Qpid, e.g. Google protocol buffers.

Regards,

Dave 

-----Original Message-----
From: Donohue, Matt [mailto:mdonohue@structure-tech.com] 
Sent: Monday, May 03, 2010 2:13 PM
To: users@qpid.apache.org
Subject: RE: Send data row as message using Qpid client

I assume you are using Red Hat Messaging?
If you install the rpm rhm-docs it will install an examples directory for each language in /usr/share/doc/rhm-0.5.

Regards,
matt

-----Original Message-----
From: Steve Olson [mailto:olson@sybase.com] 
Sent: Monday, May 03, 2010 4:06 PM
To: users@qpid.apache.org
Subject: Re: Send data row as message using Qpid client

Thanks for the quick reply. I'll check out the link.

Am programming in C/C++.

Regards,
Steve

On May 3, 2010, at May 3, 2010  5:02 PM, Jonathan Robie wrote:

> On 05/03/2010 04:47 PM, Steve Olson wrote:
>> Hello,
>>
>> I'm must getting acquainted with qpid. Have read the AMQP spec  
>> (0-10) and the messaging tutorial from red hat. I'm wondering how  
>> to send/receive a message containing one or more data rows from a  
>> database (multiple datatypes) -- the qpid client api documentation  
>> isn't especially clear (to me) on this point.
>
> If you can, I'd use the new Qpid Messaging API, shown here:
>
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html
>
> What language are you programming in? You can find a map message  
> example in C++ here:
>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_receiver.cpp
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_sender.cpp
>
> I will soon add examples in C++ and Python to Programming in Apache  
> Qpid.
>
> Jonathan
>
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


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


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


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


RE: Send data row as message using Qpid client

Posted by "Donohue, Matt" <md...@structure-tech.com>.
I assume you are using Red Hat Messaging?
If you install the rpm rhm-docs it will install an examples directory for each language in /usr/share/doc/rhm-0.5.

Regards,
matt

-----Original Message-----
From: Steve Olson [mailto:olson@sybase.com] 
Sent: Monday, May 03, 2010 4:06 PM
To: users@qpid.apache.org
Subject: Re: Send data row as message using Qpid client

Thanks for the quick reply. I'll check out the link.

Am programming in C/C++.

Regards,
Steve

On May 3, 2010, at May 3, 2010  5:02 PM, Jonathan Robie wrote:

> On 05/03/2010 04:47 PM, Steve Olson wrote:
>> Hello,
>>
>> I'm must getting acquainted with qpid. Have read the AMQP spec  
>> (0-10) and the messaging tutorial from red hat. I'm wondering how  
>> to send/receive a message containing one or more data rows from a  
>> database (multiple datatypes) -- the qpid client api documentation  
>> isn't especially clear (to me) on this point.
>
> If you can, I'd use the new Qpid Messaging API, shown here:
>
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html
>
> What language are you programming in? You can find a map message  
> example in C++ here:
>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_receiver.cpp
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_sender.cpp
>
> I will soon add examples in C++ and Python to Programming in Apache  
> Qpid.
>
> Jonathan
>
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


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


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


Re: Send data row as message using Qpid client

Posted by Jonathan Robie <jo...@redhat.com>.
On 05/03/2010 05:06 PM, Steve Olson wrote:
> Thanks for the quick reply. I'll check out the link.
>
> Am programming in C/C++.

OK, in C++ you use a Variant::Map - a sender adds map entries, then 
encodes it into a message. A receiver decodes the message content into a 
map, where it can be read by the application:

  // Sender

  Variant::Map content;
  content["id"] = 987654321;
  content["name"] = "Widget";
  content["probability"] = 0.43;
  Variant::List colours;
  colours.push_back(Variant("red"));
  colours.push_back(Variant("green"));
  colours.push_back(Variant("white"));
  content["colours"] = colours;
  content["uuid"] = Uuid(true);

  Message message;
  encode(content, message);

  sender.send(message);
  

  // Receiver

  Variant::Map content;
  decode(receiver.fetch(), content)

Hope this helps!

Jonathan

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


Re: Send data row as message using Qpid client

Posted by Steve Olson <ol...@sybase.com>.
Thanks for the quick reply. I'll check out the link.

Am programming in C/C++.

Regards,
Steve

On May 3, 2010, at May 3, 2010  5:02 PM, Jonathan Robie wrote:

> On 05/03/2010 04:47 PM, Steve Olson wrote:
>> Hello,
>>
>> I'm must getting acquainted with qpid. Have read the AMQP spec  
>> (0-10) and the messaging tutorial from red hat. I'm wondering how  
>> to send/receive a message containing one or more data rows from a  
>> database (multiple datatypes) -- the qpid client api documentation  
>> isn't especially clear (to me) on this point.
>
> If you can, I'd use the new Qpid Messaging API, shown here:
>
> http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html
>
> What language are you programming in? You can find a map message  
> example in C++ here:
>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_receiver.cpp
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_sender.cpp
>
> I will soon add examples in C++ and Python to Programming in Apache  
> Qpid.
>
> Jonathan
>
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


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


Re: Send data row as message using Qpid client

Posted by Jonathan Robie <jo...@redhat.com>.
On 05/03/2010 04:47 PM, Steve Olson wrote:
> Hello,
>
> I'm must getting acquainted with qpid. Have read the AMQP spec (0-10) 
> and the messaging tutorial from red hat. I'm wondering how to 
> send/receive a message containing one or more data rows from a 
> database (multiple datatypes) -- the qpid client api documentation 
> isn't especially clear (to me) on this point.

If you can, I'd use the new Qpid Messaging API, shown here:

http://people.apache.org/~jonathan/Programming-In-Apache-Qpid.html

What language are you programming in? You can find a map message example 
in C++ here:

https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_receiver.cpp
https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/map_sender.cpp

I will soon add examples in C++ and Python to Programming in Apache Qpid.

Jonathan




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