Skip to content

Add async behavior to Java DSL gateway(). #10018

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
artembilan opened this issue May 12, 2025 · 0 comments
Closed

Add async behavior to Java DSL gateway(). #10018

artembilan opened this issue May 12, 2025 · 0 comments

Comments

@artembilan
Copy link
Member

Technically, we can do even right now like this:

.gateway("processChannel", g -> g.async(true))

but this does nothing internally for the GatewayMessageHandler since therefore no respective async condition for the AbstractMessageProducingHandler:

		if (this.async) {
			boolean isFutureReply = reply instanceof CompletableFuture<?>;

			ReactiveAdapter reactiveAdapter = null;
			if (!isFutureReply) {
				reactiveAdapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(null, reply);
			}

			if (isFutureReply || reactiveAdapter != null) {

Since GatewayMessageHandler uses this contract interface:

@FunctionalInterface
public interface RequestReplyExchanger {

	Message<?> exchange(Message<?> request) throws MessagingException;

}

Looks like we should introduce a CompletableFuture-based exchanger.

More info in: https://stackoverflow.com/questions/79609414/spring-integration-recommended-splitter-aggregator-setup-for-async-subflow-rep.

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

1 participant