[jira] [Commented] (PROTON-1004) Inconsistency in container.create_sender
[ https://issues.apache.org/jira/browse/PROTON-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15031813#comment-15031813 ] Justin Ross commented on PROTON-1004: - The keyword args do clarify, but I don't understand why it's important to use URLs outside of container.create_link. I see two straightforward cases: {noformat} sender = event.container.create_sender("amqp://myhost:/xyz") {noformat} {noformat} conn = event.container.connect("myhost:") sender = conn.create_sender("xyz") {noformat} The first case is the convenience case, getting you to your messaging endpoint immediately. The latter is the let-me-do-it-how-I-want approach. Use a URL parser if you need to factor out elements of a URL to use in the API. With a clean separation, the user never faces the problem of the same input producing different behaviors. > Inconsistency in container.create_sender > > > Key: PROTON-1004 > URL: https://issues.apache.org/jira/browse/PROTON-1004 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Affects Versions: 0.10 >Reporter: Ted Ross >Assignee: Gordon Sim > > For URL = "localhost:5672/examples" > Using the API in two different ways: > {noformat} > def on_start(self, event): > event.container.create_sender(URL) > {noformat} > Yields an attach with the following target: > [address="examples", durable=0, timeout=0, dynamic=false] > But this variation yields something different: > {noformat} > def on_start(self, event): > conn = event.container.connect(URL, heartbeat=8) > event.container.create_sender(conn, URL) > {noformat} > yields: > [address="localhost:5672/examples", durable=0, timeout=0, dynamic=false] > The attach targets should be consistent across these examples. I believe the > first example is the correct one. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (PROTON-1004) Inconsistency in container.create_sender
[ https://issues.apache.org/jira/browse/PROTON-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14935155#comment-14935155 ] Gordon Sim commented on PROTON-1004: There are two quite different modes of use for the create_sender/create_receiver methods, as documented in pydoc. In one you give a connection object and the actual target/source address. In the other you give a url from which a connection is created and the actual target/source is inferred. So the behaviour is as intended. If in the first form you treated the target as a url to be parse, it would make it more awkward to attach to a target in the url syntax (e.g. with activemq, topics might be identified as topic://my-topic). Whether having the two modes is worth the confusion is I think subject to debate. I'm also open to ways of making it nicer overall. However I don't think simply trying to parse the exact target when using that mode is the correct approach. > Inconsistency in container.create_sender > > > Key: PROTON-1004 > URL: https://issues.apache.org/jira/browse/PROTON-1004 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Affects Versions: 0.10 >Reporter: Ted Ross >Assignee: Gordon Sim > > For URL = "localhost:5672/examples" > Using the API in two different ways: > {noformat} > def on_start(self, event): > event.container.create_sender(URL) > {noformat} > Yields an attach with the following target: > [address="examples", durable=0, timeout=0, dynamic=false] > But this variation yields something different: > {noformat} > def on_start(self, event): > conn = event.container.connect(URL, heartbeat=8) > event.container.create_sender(conn, URL) > {noformat} > yields: > [address="localhost:5672/examples", durable=0, timeout=0, dynamic=false] > The attach targets should be consistent across these examples. I believe the > first example is the correct one. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (PROTON-1004) Inconsistency in container.create_sender
[ https://issues.apache.org/jira/browse/PROTON-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14935271#comment-14935271 ] Gordon Sim commented on PROTON-1004: Proposal: Perhaps the behaviour can be made less confusing by adding a couple of explicitly named arguments to the create_sender/create_receiver calls, specifically: url - through which a url is passed, and connection - through which a connection to use is passed. The following would then be valid: {noformat} conn = event.container.connect(amqp://myhost:/xyz, heartbeat=8) event.container.create_sender(url=amqp://myhost:/xyz, connection=conn) {noformat} and would establish a link to the node xyz, using the connection first established. The same could be done by: {noformat} conn = event.container.connect(amqp://myhost:/xyz, heartbeat=8) event.container.create_sender(target=xyz, connection=conn) {noformat} As before you could skip the explicit connect step if desired: {noformat} event.container.create_sender(url=amqp://myhost:/xyz) {noformat} In which case a new connection would be established based on the details specified in the url. This would not change any current use cases, but introducing the explicit names would I think make things clearer and could be emphasised in the docs. The first positional (un-named) arg would be treated as it is now, either as a connection or as a url, depending on type. Thoughts? > Inconsistency in container.create_sender > > > Key: PROTON-1004 > URL: https://issues.apache.org/jira/browse/PROTON-1004 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Affects Versions: 0.10 >Reporter: Ted Ross >Assignee: Gordon Sim > > For URL = "localhost:5672/examples" > Using the API in two different ways: > {noformat} > def on_start(self, event): > event.container.create_sender(URL) > {noformat} > Yields an attach with the following target: > [address="examples", durable=0, timeout=0, dynamic=false] > But this variation yields something different: > {noformat} > def on_start(self, event): > conn = event.container.connect(URL, heartbeat=8) > event.container.create_sender(conn, URL) > {noformat} > yields: > [address="localhost:5672/examples", durable=0, timeout=0, dynamic=false] > The attach targets should be consistent across these examples. I believe the > first example is the correct one. -- This message was sent by Atlassian JIRA (v6.3.4#6332)