【发布时间】:2018-06-14 06:29:06
【问题描述】:
我想对两个同样使用 Spring 集成流的 Spring Boot 应用程序进行集成测试。为了测试我的应用程序,我想检查通过myMessageChannel 发送的消息。它是在其中一个应用程序的 XML 流中定义的。
如何窃听我的直接消息通道并将消息重定向到 PollableChannel,以便我可以一一阅读它们? 我在网上找到的方法都不适合我。
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {App1.class, App2.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource("classpath:integration.properties")
public class MyWireTapTest {
@Autowired
MessageChannel myMessageChannel;
@Test
public void test() {
// This is basically what I want to do
// But it does not work, since it is a direct channel
myMessageChannel.recieve();
}
}
【问题讨论】:
标签: java spring spring-boot spring-integration spring-integration-dsl