Re: Source/Target Question

2014-02-25 Thread Rafael Schloming
On Mon, Feb 24, 2014 at 8:37 AM, Ken Giusti kgiu...@redhat.com wrote:

 +1 this question - I've never quite understood Messenger's current
 behavior w.r.t. setting the source and target to the same value.


I don't think there is a good reason, I think it's just an accident of
history.



 As far as interpreting the behavior of a subscription, and the interaction
 with the API, I would think the most 'natural' approach would be:

 sub = M.subscribe(amqp://~0.0.0.0/name) would imply:

   I am a service called 'name'
   and I wish to begin receiving messages

 and

 sub = M.subscribe(amqp://0.0.0.0/name) would imply:

   I wish to receive messages
   from a node called 'name'.

 As the ~ causes Messenger to open a TCP listener on the address, and the
 absence of ~ causes Messenger to initiate a connection attempt to the
 address.

 In the two cases, I agree with Ted's point that only the Target or Source
 should be set.  My opinion: set them based on the subscription's mode:
 Target should be set in the case of ~, Source in the case of !~.

 Thoughts?


When a ~ is used messenger is not the one establishing the link, the remote
peer establishes the link so it's the remote peer that is going to end up
supplying the source and target. Currently messenger just copies whatever
the remote peer supplies and proceeds to pass through any and all incoming
messages.

As for the original question, in the general case we need to think about
local terminus/remote terminus rather than source/target as messenger has
similar behaviour for outgoing links as well as incoming links. This is
even true for ~ URLs since you can send messages to them and they will get
held in the messenger's message store until someone connects and grabs them.

Given that in many respects messenger will behave like an embedded broker
rather than just a simple client, it would in some sense be consistent for
messenger to set the local terminus to the name of the messenger unless
otherwise overridden. This is consistent with what a broker would do, e.g.
when a broker sends messages from a queue, the local terminus is the name
of the queue, when a broker receives messages into a queue, the local
terminus is still the name of the queue.

Regardless of the default though, I think we probably need a mechanism for
explicitly controlling both ends, e.g. something like
M.subscribe(source-target) for when you want a non default target.

--Rafael


Re: Source/Target Question

2014-02-24 Thread Ken Giusti
+1 this question - I've never quite understood Messenger's current behavior 
w.r.t. setting the source and target to the same value.

As far as interpreting the behavior of a subscription, and the interaction with 
the API, I would think the most 'natural' approach would be:

sub = M.subscribe(amqp://~0.0.0.0/name) would imply:

  I am a service called 'name'
  and I wish to begin receiving messages

and 

sub = M.subscribe(amqp://0.0.0.0/name) would imply:

  I wish to receive messages
  from a node called 'name'.

As the ~ causes Messenger to open a TCP listener on the address, and the 
absence of ~ causes Messenger to initiate a connection attempt to the address.

In the two cases, I agree with Ted's point that only the Target or Source 
should be set.  My opinion: set them based on the subscription's mode: Target 
should be set in the case of ~, Source in the case of !~.

Thoughts?

-K

- Original Message -
 From: Ted Ross tr...@redhat.com
 To: proton@qpid.apache.org
 Sent: Friday, February 21, 2014 3:42:21 PM
 Subject: Re: Source/Target Question
 
 Based on a discussion with Gordon, I'm not going to use source vs.
 target to infer any intent on the part of the peer node.
 
 I am, however, still interested in the answer to the question.
 
 -Ted
 
 On 02/21/2014 03:02 PM, Ted Ross wrote:
  I'm working on a feature for Dispatch Router that will allow it to
  intermediate between clients and brokers.  This raises a question
  about how Proton Messenger handles targets and sources in links.
 
  Consider a subscriber using Messenger:
 
  from proton import Messenger
  M = Messenger()
  M.start()
  sub = M.subscribe(amqp://0.0.0.0/name)
 
  The resulting incoming link (from Messenger's perspective) has a
  source of name and a target of name.
 
  The above code can have two meanings:  I am a service called 'name'
  and I wish to begin receiving messages or I wish to receive messages
  from a node called 'name'.
 
  As I understand it, the first meaning should be indicated by setting
  the target and the second meaning by setting the source. Since both
  source and target are set, the intent of the node is ambiguous.
 
  From an API perspective, how should a Messenger program indicate which
  flavor of subscription it is establishing?
 
  -Ted
 
 
 

-- 
-K


Source/Target Question

2014-02-21 Thread Ted Ross
I'm working on a feature for Dispatch Router that will allow it to 
intermediate between clients and brokers.  This raises a question about 
how Proton Messenger handles targets and sources in links.


Consider a subscriber using Messenger:

from proton import Messenger
M = Messenger()
M.start()
sub = M.subscribe(amqp://0.0.0.0/name)

The resulting incoming link (from Messenger's perspective) has a source 
of name and a target of name.


The above code can have two meanings:  I am a service called 'name' and 
I wish to begin receiving messages or I wish to receive messages from 
a node called 'name'.


As I understand it, the first meaning should be indicated by setting the 
target and the second meaning by setting the source. Since both source 
and target are set, the intent of the node is ambiguous.


From an API perspective, how should a Messenger program indicate which 
flavor of subscription it is establishing?


-Ted



Re: Source/Target Question

2014-02-21 Thread Ted Ross
Based on a discussion with Gordon, I'm not going to use source vs. 
target to infer any intent on the part of the peer node.


I am, however, still interested in the answer to the question.

-Ted

On 02/21/2014 03:02 PM, Ted Ross wrote:
I'm working on a feature for Dispatch Router that will allow it to 
intermediate between clients and brokers.  This raises a question 
about how Proton Messenger handles targets and sources in links.


Consider a subscriber using Messenger:

from proton import Messenger
M = Messenger()
M.start()
sub = M.subscribe(amqp://0.0.0.0/name)

The resulting incoming link (from Messenger's perspective) has a 
source of name and a target of name.


The above code can have two meanings:  I am a service called 'name' 
and I wish to begin receiving messages or I wish to receive messages 
from a node called 'name'.


As I understand it, the first meaning should be indicated by setting 
the target and the second meaning by setting the source. Since both 
source and target are set, the intent of the node is ambiguous.


From an API perspective, how should a Messenger program indicate which 
flavor of subscription it is establishing?


-Ted