-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create multiple sessions per connection #331
Comments
Alright I've poked around the code some more and have a slightly better idea as to what this would entail. Here's my current thinking:
Pros
Cons
I haven't yet dug into all of the code/state implications of 4 and 5 above, but implementing 1-3 seems to be more straightforward than I anticipated. If there are no objections, I'll start working up a PR with what I've described above in it so people can take a look and give their thoughts on the change and the approach. |
As far as I can tell, creating a client using the current amqp10 implementation creates a single session, which becomes tied to the client/connection and is used for all links created on that connection.
While this works well for most cases, I chatted with the Azure Service Bus about some problems that we've been seeing related to #245 and it turns out that Service Bus expects almost every link to exist within its own session (though there are some specialized cases where two links should share a session). This has significant implications around connection/disconnection of links (and general communication - Service Bus doesn't design/test for single session per connection so we can't be sure that it won't break in the future). It turns out that for many cases where Service Bus sends a detach on a link (such as when a client is idle for too long), they invalidate the entire session, rather than just the individual link. As a result, reconnecting the link doesn't always work as expected and other links that still seem to be attached can start misbehaving or simply stop responding. While all of this is going on, the actual connection is still sending heartbeats back and forth just fine.
I'm going to devote a lot more time to this tomorrow to try to think through a reasonable design to this which can support this need without making the usage pattern for other clients more complicated. My initial thought is to add something like
createSession()
to theAMQPClient
class, which would create a new session and then exposecreateSender()
andcreateReceiver()
off of whatever object gets returned. It wouldn't be as simple as that (that wouldn't handle reattach for the link vs. the session, for instance), but it seems like a reasonable starting point. Anyway, I'd be happy to hear any thoughts/concerns about this and will update with more once I've had more of a chance to think through the implications of such a change.(Side note: the AMQP Protocol Guide for Service Bus states that there should only be one session per connection, but I have confirmation from the Service Bus team that this is not the case and that the documentation is simply out of date/wrong)
The text was updated successfully, but these errors were encountered: