Skip to content

GH-10853: Fix MQTTv5 for any shared subscription pattern#10856

Merged
cppwfs merged 4 commits intospring-projects:mainfrom
artembilan:GH-10853
Mar 16, 2026
Merged

GH-10853: Fix MQTTv5 for any shared subscription pattern#10856
cppwfs merged 4 commits intospring-projects:mainfrom
artembilan:GH-10853

Conversation

@artembilan
Copy link
Copy Markdown
Member

Fixes: #10853

Apparently, not all MQTT brokers come with $share/ pattern on shared subscription topics.

  • Fix Mqttv5PahoMessageDrivenChannelAdapter to check subscribedTopic for starting $ symbol and having /
  • Adjust ClientManagerBackToBackTests.sharedTopicWithClientManager() for IBM MessageSight and Eclipse Amlen pattern with $SharedSubscription/

Auto-cherry-pick to 7.0.x & 6.5.x

Fixes: spring-projects#10853

Apparently, not all MQTT brokers come with `$share/` pattern on shared subscription topics.

* Fix `Mqttv5PahoMessageDrivenChannelAdapter` to check `subscribedTopic`
 for starting `$` symbol and having `/`
* Adjust `ClientManagerBackToBackTests.sharedTopicWithClientManager()` for
IBM MessageSight and Eclipse Amlen pattern with `$SharedSubscription/`

**Auto-cherry-pick to `7.0.x` & `6.5.x`**
@artembilan artembilan requested a review from cppwfs March 12, 2026 18:58
Apparently, Mosquitto broker does not support anything else.
* Populate a dedicated map of the configured topics and their counterpart without shared subscription pattern
* Have patter against standard `$share/`  prefix and possible `$SharedSubscription/` in some other brokers
@artembilan
Copy link
Copy Markdown
Member Author

@mrpiggi ,

I have pushed some flexible fix we all are worried about.
Feel free to review it again!

We are planning to release next week.

Thanks

Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

A couple of small questions.

Do we want to put this in the "whats-new" since we are supporting both share and SharedSubscription ?

* Rename vararg `topic` to `topics` in the `Mqttv5PahoMessageDrivenChannelAdapter.removeTopic()`
@artembilan artembilan requested a review from cppwfs March 16, 2026 14:11
Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

Thanks for the changes

LGTM

@cppwfs cppwfs merged commit b3355e4 into spring-projects:main Mar 16, 2026
3 checks passed
spring-builds pushed a commit that referenced this pull request Mar 16, 2026
* GH-10853: Fix MQTTv5 for any shared subscription pattern

Fixes: #10853

Apparently, not all MQTT brokers come with `$share/` pattern on shared subscription topics.

* Fix `Mqttv5PahoMessageDrivenChannelAdapter` to check `subscribedTopic`
 for starting `$` symbol and having `/`
* Adjust `ClientManagerBackToBackTests.sharedTopicWithClientManager()` for
IBM MessageSight and Eclipse Amlen pattern with `$SharedSubscription/`

* Bring back `$share/` for `ClientManagerBackToBackTests`.
Apparently, Mosquitto broker does not support anything else.

* Use regexp for shared subscription patterns
* Populate a dedicated map of the configured topics and their counterpart without shared subscription pattern
* Have patter against standard `$share/`  prefix and possible `$SharedSubscription/` in some other brokers

* Add mock test to verify different topics population

* Rename vararg `topic` to `topics` in the `Mqttv5PahoMessageDrivenChannelAdapter.removeTopic()`

(cherry picked from commit b3355e4)
cppwfs pushed a commit that referenced this pull request Mar 16, 2026
* GH-10853: Fix MQTTv5 for any shared subscription pattern

Fixes: #10853

Apparently, not all MQTT brokers come with `$share/` pattern on shared subscription topics.

* Fix `Mqttv5PahoMessageDrivenChannelAdapter` to check `subscribedTopic`
 for starting `$` symbol and having `/`
* Adjust `ClientManagerBackToBackTests.sharedTopicWithClientManager()` for
IBM MessageSight and Eclipse Amlen pattern with `$SharedSubscription/`

**Auto-cherry-pick to `7.0.x` & `6.5.x`**

* Bring back `$share/` for `ClientManagerBackToBackTests`.
Apparently, Mosquitto broker does not support anything else.

* Use regexp for shared subscription patterns
* Populate a dedicated map of the configured topics and their counterpart without shared subscription pattern
* Have patter against standard `$share/`  prefix and possible `$SharedSubscription/` in some other brokers

* Add mock test to verify different topics population

* Rename vararg `topic` to `topics` in the `Mqttv5PahoMessageDrivenChannelAdapter.removeTopic()`
@artembilan artembilan deleted the GH-10853 branch March 16, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared subscription prefix "$SharedSubscription" not supported

3 participants