Skip to content

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

Closed
Closed
@artembilan

Description

@artembilan

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions