Skip to content

Incomplete shutdown of Mqttv5PahoMessageDrivenChannelAdapter #3697

@mrpiggi

Description

@mrpiggi

In what version(s) of Spring Integration are you seeing this issue?

5.5.6

Describe the bug

Calling Mqttv5PahoMessageDrivenChannelAdapter.doStop() does not disconnect and close the underlying IMqttAsyncClient

@Override
protected void doStop() {
this.topicLock.lock();
String[] topics = getTopic();
try {
this.mqttClient.unsubscribe(topics).waitForCompletion(getCompletionTimeout());
}
catch (MqttException ex) {
logger.error(ex, () -> "Error unsubscribing from " + Arrays.toString(topics));
}
finally {
this.topicLock.unlock();
}
}

Expected behavior

I am not sure if the current behavior is intended or a bug. At least, calling MqttPahoMessageDrivenChannelAdapter.doStop() does exactly that

try {
this.client.disconnectForcibly(this.disconnectCompletionTimeout);
}
catch (MqttException ex) {
logger.error(ex, "Exception while disconnecting");
}
this.client.setCallback(null);
try {
this.client.close();
}
catch (MqttException ex) {
logger.error(ex, "Exception while closing");
}

If the current behavior is as desired, what do I need to do to disconnect and close the underlying IMqttAsyncClient?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions