Add toReactivePublisher(autoStartOnSubscribe)
#3657
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
IntegrationFlowBuilder.toReactivePublisher()
returns aPublisher<Message<?>>
which may be subscribed somewhere late in the application logic, e.g.
when WebSocket (or RSocket) subscription is initiated by the external client.
In between application context startup and that subscription moment, the
IntegrationFlow
must not try to produce messages since there is nothing to consumer them from the
Publisher<Message<?>>
side.One of the way is to have a source endpoint not started automatically and control its
lifecycle from the point fo reactive subscription
IntegrationFlowBuilder.toReactivePublisher(boolean autoStartOnSubscribe)
to let the framework do a job for an
IntegrationFlow
lifecycle control.This way end-user doesn't need to know autowire a starting endpoint and use
doOnSubscribe()
and similar callbacks
ConsumerEndpointFactoryBean
log message about aFixedSubscriberChannel
to
INFO
since anautoStartup = false
really does not have any effect and there is nothingfor end-user to worry about.
The
IntegrationFlow
knows nothing about each endpoint internals and cannot control whichmark as
autoStartup = false
and which not