Skip to content

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

@saiskk

Description

@saiskk

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

if (maybeSubscription.isPresent()) {
final Subscription subscription = maybeSubscription.get();
subscriptions.remove(subscription);
send(new Frame(Command.UNSUBSCRIBE, headers, null), receiptHandler);
return this;

Same goes for subscribe as well.

subscriptions.add(new Subscription(destination, id, handler));
headers.put(Frame.DESTINATION, destination);
if (!headers.containsKey(Frame.ID)) {
headers.put(Frame.ID, id);
}
Frame frame = new Frame(Command.SUBSCRIBE, headers, null);
send(frame, ar -> {
if (receiptHandler != null) {
receiptHandler.handle(ar.map(id));
}
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions