vert-x3 / vertx-stomp

STOMP client/server implementation
Apache License 2.0
30 stars 27 forks source link

Subscription removed from StompClientConnectionImpl cache even before sending UNSUBSCRIBE frame #92

Open saiskk opened 8 months ago

saiskk commented 8 months ago

Questions

Do not use this issue tracker to ask questions, instead use one of these channels. Questions will likely be closed without notice.

Version

Which version(s) did you encounter this bug ? 4.4.5

Context

In StompClientConnectionImpl class when an unsubscribe call is received, it is removed from client cache "List subscriptions" before sending the UNSUBSCRIBE frame. When this call is failed at server side, client cache doesn't have the subscription due to which we are receiving events and we cannot make another unsubscribe call as StompClientConnectionImpl would return an IllegalArgumentException

https://github.com/vert-x3/vertx-stomp/blob/55227790cb75f13cbcda764cc269efa02da652ae/src/main/java/io/vertx/ext/stomp/impl/StompClientConnectionImpl.java#L357-L361

Same goes for subscribe as well. https://github.com/vert-x3/vertx-stomp/blob/55227790cb75f13cbcda764cc269efa02da652ae/src/main/java/io/vertx/ext/stomp/impl/StompClientConnectionImpl.java#L313-L326

vietj commented 8 months ago

do you have a reproducer for this ?

saiskk commented 8 months ago

Nope I'll try to create a test case for it. Fix would be adding the subscription in cache after sending SUBSCRIBE/UNSUBSCRIBE frame, so haven't thought of reproducer.