【发布时间】:2017-09-25 15:42:38
【问题描述】:
我正在尝试通过 adviceChain 和 BeanFactoryPostProcessor 在 Spring Integration 中将 CountDownLatch 添加到 org.springframework.integration.dsl.StandardIntegrationFlow。这样做的原因是为了监视这个集成流中的消息处理程序是否被调用并完成了他的工作。
这里有一个不使用 Spring Integration 的 Java DSL 的解决方案:spring-integration unit test outbound-channel adapter。但遗憾的是,由于 Java DSL 和 StandardIntegrationFlow,它对我不起作用。 Gary Russels 解决方案如下所示:https://gist.github.com/garyrussell/5481779。我的例外是:
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?
集成流程如下所示:
@Bean
public IntegrationFlow myFlow() {
return IntegrationFlows.from(myChannel())
.handle(message -> manager.handleMessage(message))
.get();
}
我需要将CountDownLatch 添加到.handle() 部分,这样我就可以询问latch 处理程序是否已完成工作。
任何想法如何实现这一目标?
【问题讨论】:
标签: spring unit-testing spring-integration spring-integration-dsl