You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Ted Ross <tr...@redhat.com> on 2010/07/28 17:55:09 UTC

Swig wrapping the messaging API

Gordon,

I've been looking at using swig to create script wrappers (Python, Ruby, 
etc.) for the qpid::messaging API.  It turns out that the pattern used 
in that API wraps very cleanly with one exception.  The pattern of using 
Message::getProperties() to obtain a writable reference to a 
Variant::Map does not translate well into the scripting languages.  
Using getProperties to read the headers works fine.

Would you object if I added a new method as a helper?

     void Message::setProperty(const std::string& key, const 
Variant::Map& value);

This makes it easy to set message properties via a wrapped binding.

-Ted


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


Re: Swig wrapping the messaging API

Posted by Gordon Sim <gs...@redhat.com>.
On 07/28/2010 07:20 PM, Alan Conway wrote:
> On 07/28/2010 12:36 PM, Gordon Sim wrote:
>> On 07/28/2010 04:55 PM, Ted Ross wrote:
>>> Gordon,
>>>
>>> I've been looking at using swig to create script wrappers (Python, Ruby,
>>> etc.) for the qpid::messaging API. It turns out that the pattern used in
>>> that API wraps very cleanly with one exception. The pattern of using
>>> Message::getProperties() to obtain a writable reference to a
>>> Variant::Map does not translate well into the scripting languages. Using
>>> getProperties to read the headers works fine.
>>>
>>> Would you object if I added a new method as a helper?
>>>
>>> void Message::setProperty(const std::string& key, const Variant::Map&
>>> value);
>>>
>>> This makes it easy to set message properties via a wrapped binding.
>>
>> Seems reasonable to me.
>>
> If we add setProperty I'd suggest also adding getProperty for symmetry.

I agree.

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


Re: Swig wrapping the messaging API

Posted by Alan Conway <ac...@redhat.com>.
On 07/28/2010 12:36 PM, Gordon Sim wrote:
> On 07/28/2010 04:55 PM, Ted Ross wrote:
>> Gordon,
>>
>> I've been looking at using swig to create script wrappers (Python, Ruby,
>> etc.) for the qpid::messaging API. It turns out that the pattern used in
>> that API wraps very cleanly with one exception. The pattern of using
>> Message::getProperties() to obtain a writable reference to a
>> Variant::Map does not translate well into the scripting languages. Using
>> getProperties to read the headers works fine.
>>
>> Would you object if I added a new method as a helper?
>>
>> void Message::setProperty(const std::string& key, const Variant::Map&
>> value);
>>
>> This makes it easy to set message properties via a wrapped binding.
>
> Seems reasonable to me.
>
If we add setProperty I'd suggest also adding getProperty for symmetry.

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


Re: Swig wrapping the messaging API

Posted by Gordon Sim <gs...@redhat.com>.
On 07/28/2010 04:55 PM, Ted Ross wrote:
> Gordon,
>
> I've been looking at using swig to create script wrappers (Python, Ruby,
> etc.) for the qpid::messaging API. It turns out that the pattern used in
> that API wraps very cleanly with one exception. The pattern of using
> Message::getProperties() to obtain a writable reference to a
> Variant::Map does not translate well into the scripting languages. Using
> getProperties to read the headers works fine.
>
> Would you object if I added a new method as a helper?
>
> void Message::setProperty(const std::string& key, const Variant::Map&
> value);
>
> This makes it easy to set message properties via a wrapped binding.

Seems reasonable to me.

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