Skip to content
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

unsubscribe on disconnect() and/or __destruct() #131

Open
staabm opened this issue Aug 29, 2019 · 5 comments
Open

unsubscribe on disconnect() and/or __destruct() #131

staabm opened this issue Aug 29, 2019 · 5 comments

Comments

@staabm
Copy link
Member

staabm commented Aug 29, 2019

shouldn't one of the client classes keep track of all subscriptions and unsubscribe all subscriptions to cleanup server side state?

we assume this is a problem.. we realized that subscriptions don't get cleaned up because see some consumers don't disconnect from the queue point of view... not sure this is our actual problem, but I figured it would be worth noting/discussing.

@staabm staabm changed the title unsubscribe on disconnect() or __descruct() unsubscribe on disconnect() and/or __descruct() Aug 29, 2019
@staabm staabm changed the title unsubscribe on disconnect() and/or __descruct() unsubscribe on disconnect() and/or __destruct() Aug 29, 2019
@jmglsn
Copy link
Member

jmglsn commented Oct 15, 2019

  • Are you using the StatefulStomp implementation? There is SubscriptionList in use.
  • Are heartbeats configured?
  • How are subscriptions are configured? (Because it's possible to configure persistent subscriptions.)
    In general I assume that only with a heartbeat configuration both sides can detect the absence of the partner.

@whikloj
Copy link
Collaborator

whikloj commented Jun 21, 2023

@staabm doing house-keeping. Is this still an issue you are experiencing or would like to discuss?

@staabm
Copy link
Member Author

staabm commented Jun 21, 2023

we worked arround it on our end. I think it could be still a problem

@whikloj
Copy link
Collaborator

whikloj commented Jun 22, 2023

Ok, I'm still making my way through the STOMP specification and the code, but I think you were suggesting that on a $client->disconnect(); it would be nice to unsubscribe from all the queues it was subscribed to and then disconnect.

I don't think this is a problem per se, as the server is not even required to deliver any ERROR or RECEIPT frames after it receives a DISCONNECT (https://stomp.github.io/stomp-specification-1.2.html#Connection_Lingering).

But it doesn't mean it wouldn't be a nice feature.

It does appear that the use of a SubscriptionList allows for tracking all the subscriptions. But it doesn't appear to be a way to unsubscribe from them all (tell me if I'm wrong) except maybe something like

while (is_a($client->getState(), 'Stomp\States\ConsumerState')) {
    $client->getState()->unsubscribe();
}

to loop through and unsubscribe from all the subscriptions.

@staabm
Copy link
Member Author

staabm commented Jun 22, 2023

the main point IMO would be to automatically unsubsribe on __destruct(), as we experienced problems in our queue server running out of resources because the php client never unsubscribed.

It does appear that the use of a SubscriptionList allows for tracking all the subscriptions

I did not yet have a look into the details. In our solution we unsubscribe all previous subscriptions manually... thats kind of suboptimal atm on our end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants