Skip to content

Fix pub/sub subscription order on dynamic flows #3003

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

Closed
garyrussell opened this issue Jul 23, 2019 · 0 comments · Fixed by #3005
Closed

Fix pub/sub subscription order on dynamic flows #3003

garyrussell opened this issue Jul 23, 2019 · 0 comments · Fixed by #3005
Assignees
Milestone

Comments

@garyrussell
Copy link
Contributor

See https://stackoverflow.com/questions/56985297/possible-issue-with-publish-subscribe-channel/56990237#comment100856240_56990237

Since dynamic flows are started in reverse, pubsub subscriptions are started in a non-intuitive order.

@garyrussell garyrussell added this to the 5.2.x milestone Jul 23, 2019
@garyrussell garyrussell self-assigned this Jul 24, 2019
@garyrussell garyrussell modified the milestones: 5.2.x, 5.2.M4 Jul 24, 2019
garyrussell added a commit to garyrussell/spring-integration that referenced this issue Jul 24, 2019
Fixes spring-projects#3003

Statically defined flows with a publish/subscribe channel invoke the
subscriptions in natural (declared) order.

The components in the flow are started by the application context in
phases (consumers, then producers) and bean declaration order within
each phase.

When a dynamically declared flow is started, the components are started
by the `StandardIntegrationFlow` in reverse order (last to first) so that
we don't start producing messages before the flow is fully wired.

This has the side-effect that pub/sub subscribers are invoked in an
unnatural (last to first) order.

All subscription sub-flows start with a bridge from the pub/sub channel
to the first component's input channel.

The `BroadcastingDispatcher` honors the `Ordered` interface.

Change the `PublishSubscribeSpec` to set the `order` property so that
subscribers are always invoked in the natural order, regardless of whether
the flow is statically or dynamically defined.
garyrussell added a commit to garyrussell/spring-integration that referenced this issue Jul 24, 2019
Fixes spring-projects#3003

Statically defined flows with a publish/subscribe channel invoke the
subscriptions in natural (declared) order.

The components in the flow are started by the application context in
phases (consumers, then producers) and bean declaration order within
each phase.

When a dynamically declared flow is started, the components are started
by the `StandardIntegrationFlow` in reverse order (last to first) so that
we don't start producing messages before the flow is fully wired.

This has the side-effect that pub/sub subscribers are invoked in an
unnatural (last to first) order.

All subscription sub-flows start with a bridge from the pub/sub channel
to the first component's input channel.

The `BroadcastingDispatcher` honors the `Ordered` interface.

Change the `PublishSubscribeSpec` to set the `order` property so that
subscribers are always invoked in the natural order, regardless of whether
the flow is statically or dynamically defined.
artembilan pushed a commit that referenced this issue Jul 27, 2019
Fixes #3003

Statically defined flows with a publish/subscribe channel invoke the
subscriptions in natural (declared) order.

The components in the flow are started by the application context in
phases (consumers, then producers) and bean declaration order within
each phase.

When a dynamically declared flow is started, the components are started
by the `StandardIntegrationFlow` in reverse order (last to first) so that
we don't start producing messages before the flow is fully wired.

This has the side-effect that pub/sub subscribers are invoked in an
unnatural (last to first) order.

All subscription sub-flows start with a bridge from the pub/sub channel
to the first component's input channel.

The `BroadcastingDispatcher` honors the `Ordered` interface.

Change the `PublishSubscribeSpec` to set the `order` property so that
subscribers are always invoked in the natural order, regardless of whether
the flow is statically or dynamically defined.
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 a pull request may close this issue.

1 participant