Re: PHP binding via SWIG

2011-02-05 Thread Paul Colby
On Wed, Jan 26, 2011 at 10:29 PM, Gordon Sim  wrote:
> The aim for the messaging API is that it should feel natural to developers
> experienced in the particular language while retaining appropriate
> conceptual consistency across languages.

Luckily for me, PHP is very similar to C/C++, so it's actually quite
an easy / natural fit :)

> We have a wrapped .NET API for example that also adapts the API to .NET
> naming conventions etc. Are there any PHP specific adjustments or naming
> conventions we should adhere to that would make the API more palatable to
> the general PHP audience? The use of the Variant class in the c++ API seems
> like an area that would ideally be slicker for scripting languages (note: I
> know virtually nothing about PHP, I'm afraid!)

Yes, indeed, the Variant class would not seem very "natural" in PHP.
PHP provides an array that can act like both an indexed array (a la
Variant::VAR_LIST) and an associative array (a la Variant::VAR_MAP),
and can contain any native type (including more arrays).  So, in
effect, PHP has native support for hierarchical data structures like
the Variant class provides.  So it would make most sense to write a
Variant <-> PHP-native-types typemap (that's probably the only major
piece I've yet to start on... seems fairly straight-forward though).

It might also make sense to re-work some of the Duration class' static
members (eg Duration::SECOND)... I'm starting to work on that now.

> Another objective is that the API in any language would allow for an
> alternate implementation. For example someone at some stage may decide a
> particular language benefits from a native implementation, or we may find
> that a C core gives us wider reach than C++ or whatever. We want to ensure
> that we can evolve the implementation if needed without needlessly breaking
> the API that applications are using.

With the exception of some possible method renaming (see another email
I sent earlier today), and the Variant / Duration type-mapping,  the
PHP binding should be almost 100% identical to the C++ API, which as
mentioned above, is a good natural fit for PHP, so this binding should
not cause any significant issues with future API evolution (fingers
crossed) :)

> It would be great to get examples of using PHP as well. Matching the set
> that the other clients have (particularly helloworld, drain and spout) would
> be ideal.

Will do :)

helloworld is already done (except for one Duration parameter), and
looks very natural for PHP :)

will sort out drain & spout soon, as well as map_sender/receiver (very
good examples for the PHP equivalent of Variant).

> I think a separate JIRA would be best. Another one was created recently for
> perl (https://issues.apache.org/jira/browse/QPID-3009).

Done  - https://issues.apache.org/jira/browse/QPID-3027 :)

> Your contribution needs to be granted to the ASF before it can be committed.
> Assuming you haven't sent in a signed ICLA, you can do this by checking the
> box when you attach the patch to a JIRA.

Will do :)

> Thanks again for using and contributing to Qpid! Great to have you on board,

It's my pleasure!  I'm just glad I can give something back without
having to grok the entire Qpid code-base - that would take some
dedication! ;)

Paul.

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



Re: PHP binding via SWIG

2011-01-26 Thread Ted Ross
Excellent.  Please see https://issues.apache.org/jira/browse/QPID-3009 
for a similar contribution (for Perl) that was recently submitted.


-Ted

On 01/26/2011 04:43 AM, Paul Colby wrote:

On Wed, Jan 26, 2011 at 3:29 PM, Rajith Attapattu  wrote:

Hey Paul,

Thank you very much for your kind comments about Qpid and your desire to
contribute towards the project.
Perhaps it's best to create a separate JIRA for the PHP client.

Will do :)


I am sorry if you are already aware of this, but if you weren't it's best if
the PHP API follows the same model as the new Python and C++ messaging API.
That will make all the clients look and behave the same way.

Makes sense - consistency is a valuable thing :)

I was (still am) modelling the SWIG interface file on the same one
that the existing Python and Ruby bindings use
(https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/bindings/qpid/qpid.i)
- hopefully I can "%include" that file the same way that the other
bindings do, so that would basically expose all of the messaging/*.h
headers, which if I understand correctly, is the messaging API that
you're suggesting.

Thanks for the guidance.  I look forward to submitting some stuff in a
couple of days :)

Paul.


Regards,

Rajith

On Tue, Jan 25, 2011 at 10:30 PM, Paul Colby  wrote:


Hi everyone,

First of all, let me just say that I'm really impressed with Qpid!
I've been playing with the C++ broker and client library on and off
for the past couple of weeks, and I've been continually impressed with
just how well it works out of the box.  So thank you all!! :)

As well as C++, I am quite interested in using Qpid from PHP, and so
I've been experimenting with wrapping the Qpid C++ library using SWIG
(just as the python and ruby bindings currently do).  So after a lot
of playing and SWIG-debug work, I now have a (rough) PHP library that
works :)

Although I still have a fair bit of clean-up to do, it looks like all
that will be required in the end is a custom SWIG *.i interface file
for the PHP library, and a couple of minor "#if[n]def SWIGPHP"
directives in the messaging/Session.h header (to work around some
SWIG::PHP limitations).  And a relevant Makefile.am too I 'spose.

So, my question is, how would you like me to contribute the PHP work
back to Qpid?  I'm perfectly happy to just attach the final files to a
JIRA issue (would https://issues.apache.org/jira/browse/QPID-2777 be
appropriate? or should I create new JIRA issue specifically for PHP?).
  I'm also just as happy to do an "svn commit" once its ready...
whatever works best for you guys.

Thanks! :)

Paul Colby
--
http://colby.id.au

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




--
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/


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




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



Re: PHP binding via SWIG

2011-01-26 Thread Gordon Sim

On 01/26/2011 03:30 AM, Paul Colby wrote:

First of all, let me just say that I'm really impressed with Qpid!
I've been playing with the C++ broker and client library on and off
for the past couple of weeks, and I've been continually impressed with
just how well it works out of the box.  So thank you all!! :)


Thanks for the positive feedback!


As well as C++, I am quite interested in using Qpid from PHP, and so
I've been experimenting with wrapping the Qpid C++ library using SWIG
(just as the python and ruby bindings currently do).  So after a lot
of playing and SWIG-debug work, I now have a (rough) PHP library that
works :)


Fantastic!

The aim for the messaging API is that it should feel natural to 
developers experienced in the particular language while retaining 
appropriate conceptual consistency across languages.


We have a wrapped .NET API for example that also adapts the API to .NET 
naming conventions etc. Are there any PHP specific adjustments or naming 
conventions we should adhere to that would make the API more palatable 
to the general PHP audience? The use of the Variant class in the c++ API 
seems like an area that would ideally be slicker for scripting languages 
(note: I know virtually nothing about PHP, I'm afraid!)


Another objective is that the API in any language would allow for an 
alternate implementation. For example someone at some stage may decide a 
particular language benefits from a native implementation, or we may 
find that a C core gives us wider reach than C++ or whatever. We want to 
ensure that we can evolve the implementation if needed without 
needlessly breaking the API that applications are using.



Although I still have a fair bit of clean-up to do, it looks like all
that will be required in the end is a custom SWIG *.i interface file
for the PHP library, and a couple of minor "#if[n]def SWIGPHP"
directives in the messaging/Session.h header (to work around some
SWIG::PHP limitations).  And a relevant Makefile.am too I 'spose.


It would be great to get examples of using PHP as well. Matching the set 
that the other clients have (particularly helloworld, drain and spout) 
would be ideal.



So, my question is, how would you like me to contribute the PHP work
back to Qpid?  I'm perfectly happy to just attach the final files to a
JIRA issue (would https://issues.apache.org/jira/browse/QPID-2777 be
appropriate? or should I create new JIRA issue specifically for PHP?).


I think a separate JIRA would be best. Another one was created recently 
for perl (https://issues.apache.org/jira/browse/QPID-3009).



  I'm also just as happy to do an "svn commit" once its ready...
whatever works best for you guys.


Your contribution needs to be granted to the ASF before it can be 
committed. Assuming you haven't sent in a signed ICLA, you can do this 
by checking the box when you attach the patch to a JIRA.


Thanks again for using and contributing to Qpid! Great to have you on board,

--Gordon.

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



Re: PHP binding via SWIG

2011-01-26 Thread Paul Colby
On Wed, Jan 26, 2011 at 3:29 PM, Rajith Attapattu  wrote:
> Hey Paul,
>
> Thank you very much for your kind comments about Qpid and your desire to
> contribute towards the project.
> Perhaps it's best to create a separate JIRA for the PHP client.

Will do :)

> I am sorry if you are already aware of this, but if you weren't it's best if
> the PHP API follows the same model as the new Python and C++ messaging API.
> That will make all the clients look and behave the same way.

Makes sense - consistency is a valuable thing :)

I was (still am) modelling the SWIG interface file on the same one
that the existing Python and Ruby bindings use
(https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/bindings/qpid/qpid.i)
- hopefully I can "%include" that file the same way that the other
bindings do, so that would basically expose all of the messaging/*.h
headers, which if I understand correctly, is the messaging API that
you're suggesting.

Thanks for the guidance.  I look forward to submitting some stuff in a
couple of days :)

Paul.

>
> Regards,
>
> Rajith
>
> On Tue, Jan 25, 2011 at 10:30 PM, Paul Colby  wrote:
>
>> Hi everyone,
>>
>> First of all, let me just say that I'm really impressed with Qpid!
>> I've been playing with the C++ broker and client library on and off
>> for the past couple of weeks, and I've been continually impressed with
>> just how well it works out of the box.  So thank you all!! :)
>>
>> As well as C++, I am quite interested in using Qpid from PHP, and so
>> I've been experimenting with wrapping the Qpid C++ library using SWIG
>> (just as the python and ruby bindings currently do).  So after a lot
>> of playing and SWIG-debug work, I now have a (rough) PHP library that
>> works :)
>>
>> Although I still have a fair bit of clean-up to do, it looks like all
>> that will be required in the end is a custom SWIG *.i interface file
>> for the PHP library, and a couple of minor "#if[n]def SWIGPHP"
>> directives in the messaging/Session.h header (to work around some
>> SWIG::PHP limitations).  And a relevant Makefile.am too I 'spose.
>>
>> So, my question is, how would you like me to contribute the PHP work
>> back to Qpid?  I'm perfectly happy to just attach the final files to a
>> JIRA issue (would https://issues.apache.org/jira/browse/QPID-2777 be
>> appropriate? or should I create new JIRA issue specifically for PHP?).
>>  I'm also just as happy to do an "svn commit" once its ready...
>> whatever works best for you guys.
>>
>> Thanks! :)
>>
>> Paul Colby
>> --
>> http://colby.id.au
>>
>> -
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:dev-subscr...@qpid.apache.org
>>
>>
>
>
> --
> Regards,
>
> Rajith Attapattu
> Red Hat
> http://rajith.2rlabs.com/
>

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



Re: PHP binding via SWIG

2011-01-25 Thread Rajith Attapattu
Hey Paul,

Thank you very much for your kind comments about Qpid and your desire to
contribute towards the project.
Perhaps it's best to create a separate JIRA for the PHP client.

I am sorry if you are already aware of this, but if you weren't it's best if
the PHP API follows the same model as the new Python and C++ messaging API.
That will make all the clients look and behave the same way.

Regards,

Rajith

On Tue, Jan 25, 2011 at 10:30 PM, Paul Colby  wrote:

> Hi everyone,
>
> First of all, let me just say that I'm really impressed with Qpid!
> I've been playing with the C++ broker and client library on and off
> for the past couple of weeks, and I've been continually impressed with
> just how well it works out of the box.  So thank you all!! :)
>
> As well as C++, I am quite interested in using Qpid from PHP, and so
> I've been experimenting with wrapping the Qpid C++ library using SWIG
> (just as the python and ruby bindings currently do).  So after a lot
> of playing and SWIG-debug work, I now have a (rough) PHP library that
> works :)
>
> Although I still have a fair bit of clean-up to do, it looks like all
> that will be required in the end is a custom SWIG *.i interface file
> for the PHP library, and a couple of minor "#if[n]def SWIGPHP"
> directives in the messaging/Session.h header (to work around some
> SWIG::PHP limitations).  And a relevant Makefile.am too I 'spose.
>
> So, my question is, how would you like me to contribute the PHP work
> back to Qpid?  I'm perfectly happy to just attach the final files to a
> JIRA issue (would https://issues.apache.org/jira/browse/QPID-2777 be
> appropriate? or should I create new JIRA issue specifically for PHP?).
>  I'm also just as happy to do an "svn commit" once its ready...
> whatever works best for you guys.
>
> Thanks! :)
>
> Paul Colby
> --
> http://colby.id.au
>
> -
> Apache Qpid - AMQP Messaging Implementation
> Project:  http://qpid.apache.org
> Use/Interact: mailto:dev-subscr...@qpid.apache.org
>
>


-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/


PHP binding via SWIG

2011-01-25 Thread Paul Colby
Hi everyone,

First of all, let me just say that I'm really impressed with Qpid!
I've been playing with the C++ broker and client library on and off
for the past couple of weeks, and I've been continually impressed with
just how well it works out of the box.  So thank you all!! :)

As well as C++, I am quite interested in using Qpid from PHP, and so
I've been experimenting with wrapping the Qpid C++ library using SWIG
(just as the python and ruby bindings currently do).  So after a lot
of playing and SWIG-debug work, I now have a (rough) PHP library that
works :)

Although I still have a fair bit of clean-up to do, it looks like all
that will be required in the end is a custom SWIG *.i interface file
for the PHP library, and a couple of minor "#if[n]def SWIGPHP"
directives in the messaging/Session.h header (to work around some
SWIG::PHP limitations).  And a relevant Makefile.am too I 'spose.

So, my question is, how would you like me to contribute the PHP work
back to Qpid?  I'm perfectly happy to just attach the final files to a
JIRA issue (would https://issues.apache.org/jira/browse/QPID-2777 be
appropriate? or should I create new JIRA issue specifically for PHP?).
 I'm also just as happy to do an "svn commit" once its ready...
whatever works best for you guys.

Thanks! :)

Paul Colby
--
http://colby.id.au

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