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#8705
an internal `MethodInvocationGateway` is a `MessagingGatewaySupport`
extension with all the logic available there.
One of the option introduced in `5.2.2` to be able to throw a `MessageTimeoutException`
instead of returning `null` when no reply received in time from downstream flow
* Expose an `errorOnTimeout` on the `@MessagingGateway` and `GatewayEndpointSpec`
* Propagate this option from a `GatewayProxyFactoryBean` down to its internal
`MethodInvocationGateway` implementation
* Modify couple tests to react for `errorOnTimeout` set to `true`
* Document the feature
Fix language in Docs
Co-authored-by: Gary Russell <[email protected]>
Copy file name to clipboardExpand all lines: spring-integration-core/src/main/java/org/springframework/integration/gateway/AnnotationGatewayProxyFactoryBean.java
+3-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2017-2022 the original author or authors.
2
+
* Copyright 2017-2023 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.
Copy file name to clipboardExpand all lines: spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java
+15
Original file line number
Diff line number
Diff line change
@@ -166,6 +166,8 @@ public class GatewayProxyFactoryBean<T> extends AbstractEndpoint
166
166
167
167
privateMetricsCaptormetricsCaptor;
168
168
169
+
privatebooleanerrorOnTimeout;
170
+
169
171
/**
170
172
* Create a Factory whose service interface type can be configured by setter injection.
171
173
* If none is set, it will fall back to the default service interface type,
@@ -455,6 +457,18 @@ public void registerMetricsCaptor(MetricsCaptor metricsCaptorToRegister) {
Copy file name to clipboardExpand all lines: src/reference/antora/modules/ROOT/pages/gateway.adoc
+6
Original file line number
Diff line number
Diff line change
@@ -794,6 +794,8 @@ If a component downstream is still running (perhaps because of an infinite loop
794
794
However, if the timeout has been reached before the actual reply was produced, it could result in a 'null' return from the gateway method.
795
795
You should understand that the reply message (if produced) is sent to a reply channel after the gateway method invocation might have returned, so you must be aware of that and design your flow with it in mind.
796
796
797
+
Also see the `errorOnTimeout` property to throw a `MessageTimeoutException` instead of returning `null`, when a timeout occurs.
798
+
797
799
[[downstream-component-returns-null-]]
798
800
=== Downstream Component Returns 'null'
799
801
@@ -838,4 +840,8 @@ At that time, the calling thread starts waiting for the reply.
838
840
If the flow was completely synchronous, the reply is immediately available.
839
841
For asynchronous flows, the thread waits for up to this time.
840
842
843
+
Starting with version 6.2, the `errorOnTimeout` property of the internal `MethodInvocationGateway` extension of the `MessagingGatewaySupport` is exposed on the `@MessagingGateway` and `GatewayEndpointSpec`.
844
+
This option has exactly the same meaning as for any inbound gateway explained in the end of xref:endpoint-summary.adoc#endpoint-summary[Endpoint Summary] chapter.
845
+
In other words, setting this option to `true`, would lead to the `MessageTimeoutException` being thrown from a send-and-receive gateway operation instead of returning `null` when the receive timeout is exhausted.
846
+
841
847
See xref:dsl/integration-flow-as-gateway.adoc[`IntegrationFlow` as Gateway] in the Java DSL chapter for options to define gateways through `IntegrationFlow`.
Copy file name to clipboardExpand all lines: src/reference/antora/modules/ROOT/pages/whats-new.adoc
+2
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ See, for example, `transformWith()`, `splitWith()` in xref:dsl.adoc#java-dsl[ Ja
36
36
- A new `spring.integration.endpoints.defaultTimeout` global property has been introduced to override the default 30 seconds timeout for all the endpoints in the application.
37
37
See xref:configuration/global-properties.adoc[Global Properties] for more information.
38
38
39
+
- The `@MessagingGateway` and `GatewayEndpointSpec` provided by the Java DSL now expose the `errorOnTimeout` property of the internal `MethodInvocationGateway` extension of the `MessagingGatewaySupport`.
40
+
See xref:gateway.adoc#gateway-no-response[ Gateway Behavior When No response Arrives] for more information.
0 commit comments