You are viewing a plain text version of this content. The canonical link for it is here.
Posted to proton@qpid.apache.org by Simon MacMullen <si...@rabbitmq.com> on 2013/01/15 15:33:32 UTC
Messenger API - what am I missing?
Hi.
I'm interested in testing Proton against the RabbitMQ AMQP 1.0 adapter.
But I'm struggling with the APIs I need to use to write even a simple
program. I'm using the Java version but from what I can see the C
version has the same APIs.
If I try to use the Messenger API then I don't see how I can specify a
source or target on any of my links - and indeed the examples I can see
showing use of the Messenger API don't do that. Indeed I don't seem to
be able to specify very much, but the lack of source / target means I
can't specify where I publish to or consume from.
And if I run the examples and don't specify source / target I seem to
end up sending attach frames with these bits missing - which the spec
says means I will never send or receive messages!
I tried using the lower level API (Driver / Connector / Connection /
Session / Link / Message etc) but gave up when I got to 100 lines of
code and hadn't sent a message - I assume I'm not supposed to use them
directly?
So what am I missing here? I assume there's some part of the API I don't
understand...
Cheers, Simon
--
Simon MacMullen
RabbitMQ, VMware
Re: Messenger API - what am I missing?
Posted by Simon MacMullen <si...@rabbitmq.com>.
Yes, the Python version works as I would expect, modulo:
* It strips the leading "/" from the target address
* On my machine, "localhost" resolves to ::1, and Proton appears not to
support IPv6.
But both of those can be worked around. Thank you!
Cheers, Simon
On 15/01/13 16:11, Rafael Schloming wrote:
> That looks to me like it's a bug, possibly in the Java Messenger
> implementation, or possibly some kind of interop bug. Any chance you
> could try the same example in python and see if it works any better?
>
> messenger = Messenger()
> messenger.start()
>
> msg = Message()
> msg.address = "amqp://localhost:5672/queue/test"
> messenger.put(msg)
> messenger.send()
>
> messenger.stop()
>
> --Rafael
>
> On Tue, Jan 15, 2013 at 10:46 AM, Simon MacMullen <simon@rabbitmq.com
> <ma...@rabbitmq.com>> wrote:
>
> On 15/01/13 15:29, Rafael Schloming wrote:
>
> I'm guessing you need to set an address on the message.
> Messenger doesn't
> expose direct control over connections or links. It will figure
> out what
> connections/links to establish based on what address you specify
> on the
> message (kind of like SMTP). You could use something like
> "amqp://host/target".
>
> If you post your messenger code snippet I'd be happy to comment
> in more
> detail.
>
>
> Thank you! So this was indeed my first idea of how to use it. So
> with what I suspect is the simplest possible example:
>
> Messenger mr = new MessengerImpl();
> mr.start();
> Message m = new MessageImpl();
> m.setAddress("amqp://__localhost:5672/queue/test");
> mr.put(m);
> mr.send();
>
> I then see Proton setting the name field on the attach frame to
> "/queue/test" - and source and target are blank:
>
> 1.0 frame decoded: {'v1_0.attach',[{name,{utf8,<<__"/queue/test">>}},
> {handle,{uint,0}},
> {role,false},
> {snd_settle_mode,{ubyte,2}},
> {rcv_settle_mode,{ubyte,0}},
> {source,undefined},
> {target,undefined},
> {unsettled,undefined},
> {incomplete_unsettled,false},
> {initial_delivery_count,{uint,__0}},
> {max_message_size,undefined},
> {offered_capabilities,__undefined},
> {desired_capabilities,__undefined},
> {properties,undefined}]}
>
> (Please forgive the less-than-beautiful formatting from our adapter.)
>
>
> Cheers, Simon
>
> --
> Simon MacMullen
> RabbitMQ, VMware
>
>
--
Simon MacMullen
RabbitMQ, VMware
Re: Messenger API - what am I missing?
Posted by Simon MacMullen <si...@rabbitmq.com>.
On 15/01/13 15:29, Rafael Schloming wrote:
> I'm guessing you need to set an address on the message. Messenger doesn't
> expose direct control over connections or links. It will figure out what
> connections/links to establish based on what address you specify on the
> message (kind of like SMTP). You could use something like
> "amqp://host/target".
>
> If you post your messenger code snippet I'd be happy to comment in more
> detail.
Thank you! So this was indeed my first idea of how to use it. So with
what I suspect is the simplest possible example:
Messenger mr = new MessengerImpl();
mr.start();
Message m = new MessageImpl();
m.setAddress("amqp://localhost:5672/queue/test");
mr.put(m);
mr.send();
I then see Proton setting the name field on the attach frame to
"/queue/test" - and source and target are blank:
1.0 frame decoded: {'v1_0.attach',[{name,{utf8,<<"/queue/test">>}},
{handle,{uint,0}},
{role,false},
{snd_settle_mode,{ubyte,2}},
{rcv_settle_mode,{ubyte,0}},
{source,undefined},
{target,undefined},
{unsettled,undefined},
{incomplete_unsettled,false},
{initial_delivery_count,{uint,0}},
{max_message_size,undefined},
{offered_capabilities,undefined},
{desired_capabilities,undefined},
{properties,undefined}]}
(Please forgive the less-than-beautiful formatting from our adapter.)
Cheers, Simon
--
Simon MacMullen
RabbitMQ, VMware
Re: Messenger API - what am I missing?
Posted by Rafael Schloming <rh...@alum.mit.edu>.
On Tue, Jan 15, 2013 at 9:33 AM, Simon MacMullen <si...@rabbitmq.com> wrote:
> Hi.
>
> I'm interested in testing Proton against the RabbitMQ AMQP 1.0 adapter.
> But I'm struggling with the APIs I need to use to write even a simple
> program. I'm using the Java version but from what I can see the C version
> has the same APIs.
>
> If I try to use the Messenger API then I don't see how I can specify a
> source or target on any of my links - and indeed the examples I can see
> showing use of the Messenger API don't do that. Indeed I don't seem to be
> able to specify very much, but the lack of source / target means I can't
> specify where I publish to or consume from.
>
> And if I run the examples and don't specify source / target I seem to end
> up sending attach frames with these bits missing - which the spec says
> means I will never send or receive messages!
>
> I tried using the lower level API (Driver / Connector / Connection /
> Session / Link / Message etc) but gave up when I got to 100 lines of code
> and hadn't sent a message - I assume I'm not supposed to use them directly?
>
> So what am I missing here? I assume there's some part of the API I don't
> understand...
>
I'm guessing you need to set an address on the message. Messenger doesn't
expose direct control over connections or links. It will figure out what
connections/links to establish based on what address you specify on the
message (kind of like SMTP). You could use something like
"amqp://host/target".
If you post your messenger code snippet I'd be happy to comment in more
detail.
--Rafael