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.
This commit is contained in:
@@ -156,9 +156,7 @@ public class FlowServiceTests {
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow testGateway() {
|
||||
return f -> f.gateway("processChannel", g -> g.replyChannel("replyChannel").async(true))
|
||||
.enrichHeaders(headers ->
|
||||
headers.headerExpression("currentThread", "T (Thread).currentThread().name"));
|
||||
return f -> f.gateway("processChannel", g -> g.replyChannel("replyChannel").async(true));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -166,6 +164,8 @@ public class FlowServiceTests {
|
||||
return IntegrationFlow
|
||||
.from("processChannel")
|
||||
.<String, String>transform(String::toUpperCase)
|
||||
.enrichHeaders(headers ->
|
||||
headers.headerExpression("currentThread", "T (Thread).currentThread().name"))
|
||||
.channel("replyChannel")
|
||||
.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user