You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Justin Ross <ju...@gmail.com> on 2015/03/03 20:52:11 UTC

Proton reactor send and receive tools

In PROTON-818, Cliff has introduced some examples using the C reactor
interfaces.  For simple programs, they are pretty long.

  - reactor-recv.c - http://goo.gl/4QkqsE - 447 lines
  - reactor-send.c - http://goo.gl/Zcg9Sy - 389 lines

Some questions:

 - The examples carry connections in a context in order to do clean
shutdown.  Is that something the reactor should be capable of doing?

 - There's also a little extra logic in these to do clean object deletion.
Is there a better way to handle the references to avoid this?

 - There's some state management for timeouts.  Could that go into a
standard handler?  It seems like it will be a common case.

 - Can the endpoint setup in these examples go into a standard handler?

 - The message handling is verbose.  It seems attractive to have something
akin to the message.send and .recv that we have in Python.

Justin

Re: Proton reactor send and receive tools

Posted by Alan Conway <ac...@redhat.com>.
On Tue, 2015-03-03 at 14:52 -0500, Justin Ross wrote:
> In PROTON-818, Cliff has introduced some examples using the C reactor
> interfaces.  For simple programs, they are pretty long.
> 
>   - reactor-recv.c - http://goo.gl/4QkqsE - 447 lines
>   - reactor-send.c - http://goo.gl/Zcg9Sy - 389 lines
> 
> Some questions:
> 
>  - The examples carry connections in a context in order to do clean
> shutdown.  Is that something the reactor should be capable of doing?
> 
>  - There's also a little extra logic in these to do clean object deletion.
> Is there a better way to handle the references to avoid this?
> 
>  - There's some state management for timeouts.  Could that go into a
> standard handler?  It seems like it will be a common case.
> 
>  - Can the endpoint setup in these examples go into a standard handler?
> 
>  - The message handling is verbose.  It seems attractive to have something
> akin to the message.send and .recv that we have in Python.
> 
> Justin

FYI there are already send/receive examples in
~/proton/examples/engine/c/ - they're pre-reactor, using events
directly. Probably we should merge their features with the reactor
examples and have one set showing the recommended approach and acting as
building blocks for tests.




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


Re: Proton reactor send and receive tools

Posted by Rafael Schloming <rh...@alum.mit.edu>.
On Tue, Mar 3, 2015 at 2:52 PM, Justin Ross <ju...@gmail.com> wrote:

> In PROTON-818, Cliff has introduced some examples using the C reactor
> interfaces.  For simple programs, they are pretty long.
>
>   - reactor-recv.c - http://goo.gl/4QkqsE - 447 lines
>   - reactor-send.c - http://goo.gl/Zcg9Sy - 389 lines
>
> Some questions:
>
>  - The examples carry connections in a context in order to do clean
> shutdown.  Is that something the reactor should be capable of doing?
>

I'm not 100% sure what you mean by this, but these programs do make
unnecessary use of both handlers and contexts. I asked about this in the
review and cliff said he wanted to test the capability. Based on that I was
assuming these weren't examples, but were actually tests.


>   - There's also a little extra logic in these to do clean object deletion.
> Is there a better way to handle the references to avoid this?
>

Yes, if you use an the attachments API rather than the context API then you
can declare your pointer to be refcounted and the cleanup will happen
automatically.


>
>  - There's some state management for timeouts.  Could that go into a
> standard handler?  It seems like it will be a common case.
>

There's a bunch of standard handler stuff in python that could be brought
into C. Unless there is an urgent need for it in C though it might be
better to let the python stuff get some use first.


>   - Can the endpoint setup in these examples go into a standard handler?
>

Yeah, (see previous answer).


>  - The message handling is verbose.  It seems attractive to have something
> akin to the message.send and .recv that we have in Python.
>

Yes, I expect to add that soon.

In general there is less syntactic sugar and a smaller handler library in C
than in python, so I would expect C examples to be a bit more verbose than
python. Even so, we should be able to provide a much more comparable
example. I think the parallel C/python example I posted a while back had a
much more concise send/recv embedded in it.

--Rafael