Skip to content

Conversation

artembilan
Copy link
Member

We cannot always reset readyToSubscribeOnStart to false in the stop() since we may be connected to ClientManager and have cleanStart option, so we unsubscribe() in the stop and then when we start there is no way to subscribe back

  • Reset readyToSubscribeOnStart in the AbstractMqttMessageDrivenChannelAdapter.doStop() only if we don't unsubscribe for a cleanSession reason.
  • Also reset it in the connectionLost, so next connectComplete will take care about subscription or readyToSubscribeOnStart state change
  • Use isActive() instead of isRunning() in the connectComplete() since there is a race condition when connection is established but doStart() has not returned yet, but already passed if (this.readyToSubscribeOnStart) line

We cannot always reset `readyToSubscribeOnStart` to `false` in the `stop()`
since we may be connected to `ClientManager` and have `cleanStart` option,
so we `unsubscribe()` in the stop and then when we start there is no way to subscribe back

* Reset `readyToSubscribeOnStart` in the `AbstractMqttMessageDrivenChannelAdapter.doStop()`
only if we don't unsubscribe for a `cleanSession` reason.
* Also reset it in the `connectionLost`, so next `connectComplete` will take care about subscription
or `readyToSubscribeOnStart` state change
* Use `isActive()` instead of `isRunning()` in the `connectComplete()` since there is a race
condition when connection is established but `doStart()` has not returned yet, but already passed
`if (this.readyToSubscribeOnStart)` line
@artembilan artembilan added this to the 6.0.3 milestone Feb 18, 2023
@garyrussell garyrussell merged commit ee2b6b4 into spring-projects:main Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants