Skip to content

Commit 8ff3fbd

Browse files
committed
Fix threading for FlowServiceTests.testGatewayExplicitReplyChannel
The `enrichHeaders()` operator is put already after an async `gateway()` in the `testGateway` flow definition. This means that the action of the `enrichHeaders()` could be performed on the returning thread from gateway, or main. * Move `enrichHeaders()` down to the `subFlow()` bean definition when all the operators are executed as part of the gateway request from the `testGateway` flow definition.
1 parent 42b281b commit 8ff3fbd

File tree

1 file changed

+3
-3
lines changed
  • spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices

1 file changed

+3
-3
lines changed

spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ public static class ContextConfiguration {
156156

157157
@Bean
158158
public IntegrationFlow testGateway() {
159-
return f -> f.gateway("processChannel", g -> g.replyChannel("replyChannel").async(true))
160-
.enrichHeaders(headers ->
161-
headers.headerExpression("currentThread", "T (Thread).currentThread().name"));
159+
return f -> f.gateway("processChannel", g -> g.replyChannel("replyChannel").async(true));
162160
}
163161

164162
@Bean
165163
public IntegrationFlow subFlow() {
166164
return IntegrationFlow
167165
.from("processChannel")
168166
.<String, String>transform(String::toUpperCase)
167+
.enrichHeaders(headers ->
168+
headers.headerExpression("currentThread", "T (Thread).currentThread().name"))
169169
.channel("replyChannel")
170170
.get();
171171
}

0 commit comments

Comments
 (0)