Skip to content

Conversation

artembilan
Copy link
Member

The IntegrationFlowBuilder.toReactivePublisher() returns a Publisher<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

  • Introduce an 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
  • Change ConsumerEndpointFactoryBean log message about a FixedSubscriberChannel
    to INFO since an autoStartup = false really does not have any effect and there is nothing
    for end-user to worry about.
    The IntegrationFlow knows nothing about each endpoint internals and cannot control which
    mark as autoStartup = false and which not

The `IntegrationFlowBuilder.toReactivePublisher()` returns a `Publisher<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

* Introduce an `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
* Change `ConsumerEndpointFactoryBean` log message about a `FixedSubscriberChannel`
to `INFO` since an `autoStartup = false` really does not have any effect and there is nothing
for end-user to worry about.
The `IntegrationFlow` knows nothing about each endpoint internals and cannot control which
mark as `autoStartup = false` and which not
@artembilan
Copy link
Member Author

Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

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

Minor javadoc polishing.

Co-authored-by: Gary Russell <grussell@vmware.com>
@garyrussell garyrussell merged commit eb4d583 into spring-projects:main Nov 1, 2021
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