Skip to content
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

The PublisherIntegrationFlow does not take into account AbstractEndpoint when marks its components for autoStartup(false) #8950

Closed
artembilan opened this issue Feb 23, 2024 · 0 comments

Comments

@artembilan
Copy link
Member

artembilan commented Feb 23, 2024

This way when we have a flow like this:

@Bean
	public Publisher<Message<byte[]>> debeziumPublisher(Builder<ChangeEvent<byte[], byte[]>> debeziumEngineBuilder) {
		return IntegrationFlow.from(Debezium.inboundChannelAdapter(debeziumEngineBuilder))
				.toReactivePublisher(true);
	}

That DebeziumMessageProducer starts producing messages immediately.
However expectations is to wait until subscription to that returned Publisher.

@artembilan artembilan added this to the 6.3.0-M2 milestone Feb 23, 2024
@artembilan artembilan changed the title The PublisherIntegrationFlow does not take into account MessageProducerSpec and MessagingGatewaySpec when marks its components for autoStartup(false) The PublisherIntegrationFlow does not take into account AbstractEndpoint when marks its components for autoStartup(false) Feb 23, 2024
spring-builds pushed a commit that referenced this issue Feb 23, 2024
Fixes: #8950

The `IntegrationFlow.toReactivePublisher(true)` makes `PublisherIntegrationFlow`
to be stopped from the beginning and waiting for the `Publisher.subscribe()`.
However only `EndpointSpec` components are marked as `autoStartup(false)`.
The `MessageProducerSupport` is not included, therefore unexpected messages
are produced to the channel in the end of flow without subscribers.

* Check for `AbstractEndpoint` component type in the `PublisherIntegrationFlow`
and mark it as `setAutoStartup(false)`
* Ensure in a new `ReactiveStreamsTests.messageProducerIsNotStartedAutomatically()` test
that `MessageProducerSupport` is not started from the beginning,
but rather when we subscribe to the `Publisher` via `StepVerifier`

(cherry picked from commit 2b576c5)
artembilan added a commit that referenced this issue Feb 23, 2024
Fixes: #8950

The `IntegrationFlow.toReactivePublisher(true)` makes `PublisherIntegrationFlow`
to be stopped from the beginning and waiting for the `Publisher.subscribe()`.
However only `EndpointSpec` components are marked as `autoStartup(false)`.
The `MessageProducerSupport` is not included, therefore unexpected messages
are produced to the channel in the end of flow without subscribers.

* Check for `AbstractEndpoint` component type in the `PublisherIntegrationFlow`
and mark it as `setAutoStartup(false)`
* Ensure in a new `ReactiveStreamsTests.messageProducerIsNotStartedAutomatically()` test
that `MessageProducerSupport` is not started from the beginning,
but rather when we subscribe to the `Publisher` via `StepVerifier`

(cherry picked from commit 2b576c5)

# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants