I´m trying to add a CountDownLatch
to an org.springframework.integration.dsl.StandardIntegrationFlow
in Spring Integration via an adviceChain
and the BeanFactoryPostProcessor
. The reason for this is to monitor, if the message handler within this integration flow was called and has finished his work or not.
There is a solution without using the Java DSL of Spring Integration here: spring-integration unit test outbound-channel adapter. But sadly it´s not working for me because of the Java DSL and the StandardIntegrationFlow
. Gary Russels solution looks like this: https://gist.github.com/garyrussell/5481779. My exception trying this is:
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'adviceChain' of bean class [org.springframework.integration.dsl.StandardIntegrationFlow]:
Bean property 'adviceChain' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
The integration flow looks like this:
@Bean
public IntegrationFlow myFlow() {
return IntegrationFlows.from(myChannel())
.handle(message -> manager.handleMessage(message))
.get();
}
I need to add a CountDownLatch
to the .handle()
part, thus enabling me to ask the latch if the handler has finished its work.
Any ideas how to achieve this?