Skip to content

Subscription Identifier always included when adding an mqtt topic on MQTT 5 #9214

Closed
@MarcelFadtke

Description

@MarcelFadtke

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

6.3.0.RELEASE

(likely since / caused by #8879)

Describe the bug

When adding a topic to the subscriptions, the following section causes the inclusion of a subscription identifier even if the server sent that the subscription identifiers are not available (during the connection by the Connect Ack response) or if the paho mqtt client connection options are configured to not use subscription identifiers.

Code:

MqttProperties subscriptionProperties = new MqttProperties();
subscriptionProperties.setSubscriptionIdentifier(this.subscriptionIdentifierCounter.incrementAndGet());
this.mqttClient.subscribe(new MqttSubscription[] {subscription},
null, null, new IMqttMessageListener[] {this::messageArrived}, subscriptionProperties)
.waitForCompletion(getCompletionTimeout());

To Reproduce

Setup an mqtt 5 client and connect to a broker and adding a topic programatically, while tracking the mqtt message properties with wireshark.

Expected behavior

The method includes mqtt connection settings from the server's Connect Ack message and the configured client MqttConnectionOption, so that the subscription identifier usage can be disabled / turned off.

Sample

A link to a GitHub repository with a minimal, reproducible sample.

Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions