You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes: #10018
The `GatewayEndpointSpec` configuration of the `gateway()` operator support already an `async(true)` option.
However, it is silently ignored internally since no real async contract provided for the gateway proxy.
* Introduce the `AsyncRequestReplyExchanger` interface to use instead of `RequestReplyExchanger`,
when `gateway()` operator is opted-in for the `async(true)`
* Use this new `AsyncRequestReplyExchanger` in the `GatewayMessageHandler` when `async(true)`
* Also, expose a `GatewayEndpointSpec.asyncExecutor(Executor)` option to support async behavior similar to the `@MessagingGateway`
Copy file name to clipboardExpand all lines: spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2016-2024 the original author or authors.
2
+
* Copyright 2016-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -118,6 +118,7 @@ public void testGatewayExplicitReplyChannel() {
IMPORTANT: If the downstream flow does not always return a reply, you should set the `requestTimeout` to 0 to prevent hanging the calling thread indefinitely.
35
35
In that case, the flow will end at that point and the thread released for further work.
36
36
37
+
Starting with version 6.5, this `gateway()` operator fully supports an `async(true)` behaviour.
38
+
Internally, an `AsyncRequestReplyExchanger` service interface is provided for the `GatewayProxyFactoryBean`.
39
+
And since `AsyncRequestReplyExchanger` contract is a `CompletableFuture<Message<?>>`, the whole request-reply is executed in asynchronous manner.
Copy file name to clipboardExpand all lines: src/reference/antora/modules/ROOT/pages/gateway.adoc
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -560,6 +560,12 @@ int finalResult = result.get(1000, TimeUnit.SECONDS);
560
560
561
561
For a more detailed example, see the https://github.com/spring-projects/spring-integration-samples/tree/main/intermediate/async-gateway[async-gateway] sample in the Spring Integration samples.
562
562
563
+
Also, starting with version 6.5, the Java DSL `gateway()` operator fully supports an `async(true)` behaviour.
564
+
Internally, an `AsyncRequestReplyExchanger` service interface is provided for the `GatewayProxyFactoryBean`.
565
+
And since `AsyncRequestReplyExchanger` contract is a `CompletableFuture<Message<?>>`, the whole request-reply is executed in asynchronous manner.
566
+
This behavior is useful, for example, in case of splitter-aggregator scenario when another flow has to be called for each item.
567
+
However, the order is not important - only their group gathering on the aggregator after all processing.
0 commit comments