-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Spring Integration hits a bug in Paho client with $share/ MQTT subscriptions #8879
Comments
Are you referring to this property:
? I think there might be some other props which could be set for this or that use-case.
So, I'm not sure if we have to expose the whole If that would work as a workaround, then I'm more than happy to accept such a contribution. Thanks |
Yes.
I am not sure if it needs to be exposed at all. The subscription identifier can be an internal detail. It is only useful for the client's internal mapping, I think. At least in my use case.
|
Well, that would be easier, but then we need to understand what is that number supposed to be. The point is that we might need to back-port this to previous version to provide the support for lost functionality. Here is some discussion as well: https://stackoverflow.com/questions/75950944/shared-subscription-with-spring-integration-mqttv5-not-receiving-messages |
The subscription identifier is an integer:
|
Add test for shared topics.
Fixes: #8879 To work around the problem with `$share/` subscriptions the `Mqttv5PahoMessageDrivenChannelAdapter` must provide a `subscriptionIdentifier` into `MqttProperties` on `subscribe()` * Introduce a `Mqttv5PahoMessageDrivenChannelAdapter.subscriptionIdentifierCounter` according to the MQTT specification: > 3.8.2.1.2 Subscription Identifier: [..]The Subscription Identifier is associated with any subscription created or modified as the result of this SUBSCRIBE packet. If there is a Subscription Identifier, it is stored with the subscription. This one is associated with the MQTT session for the current subscriber and does not interfere into other sessions even if identifier is same from the counter. It works because the Subscription identifier is per session and because you cannot have multiple connection with the same client ID. **Cherry-pick to `6.2.x` & `6.1.x`** # Conflicts: # spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/Mqttv5PahoMessageDrivenChannelAdapter.java
Fixes: #8879 To work around the problem with `$share/` subscriptions the `Mqttv5PahoMessageDrivenChannelAdapter` must provide a `subscriptionIdentifier` into `MqttProperties` on `subscribe()` * Introduce a `Mqttv5PahoMessageDrivenChannelAdapter.subscriptionIdentifierCounter` according to the MQTT specification: > 3.8.2.1.2 Subscription Identifier: [..]The Subscription Identifier is associated with any subscription created or modified as the result of this SUBSCRIBE packet. If there is a Subscription Identifier, it is stored with the subscription. This one is associated with the MQTT session for the current subscriber and does not interfere into other sessions even if identifier is same from the counter. It works because the Subscription identifier is per session and because you cannot have multiple connection with the same client ID. **Cherry-pick to `6.2.x` & `6.1.x`** # Conflicts: # spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/Mqttv5PahoMessageDrivenChannelAdapter.java
Spring Integration hits a bug in Paho client with $share/ MQTT subscriptions
In what version(s) of Spring Integration are you seeing this issue?
For example:
6.1.5
Describe the bug
Spring Integration hits a bug (eclipse/paho.mqtt.java/issues/827) in Paho MQTT client with
$share/
MQTT subscriptions. This bug can be worked around by using subscription ID by providing it inMqttProperties
when calling, e.g.,org.eclipse.paho.mqttv5.client.IMqttAsyncClient#subscribe(org.eclipse.paho.mqttv5.common.MqttSubscription[], java.lang.Object, org.eclipse.paho.mqttv5.client.MqttActionListener, org.eclipse.paho.mqttv5.client.IMqttMessageListener, org.eclipse.paho.mqttv5.common.packet.MqttProperties)
. Unfortunately, Spring Integration currently calls onlyorg.eclipse.paho.mqttv5.client.IMqttAsyncClient#subscribe(org.eclipse.paho.mqttv5.common.MqttSubscription, org.eclipse.paho.mqttv5.client.IMqttMessageListener)
fromorg.springframework.integration.mqtt.inbound.Mqttv5PahoMessageDrivenChannelAdapter#addTopic
and does not provide subscription ID.To Reproduce
Subscribe on
$share/sharegroup/topic
usingMqttv5PahoMessageDrivenChannelAdapter
and send message totopic
. The message will be received but it will be rejected by Paho itself because it is comparing the filter and the message topic textually without removing the$share/sharegroup/
prefix.Expected behavior
Mqttv5PahoMessageDrivenChannelAdapter
should be able to subscribe to shared MQTT topics.Sample
N/A
The text was updated successfully, but these errors were encountered: