此处为 Spring Integration 5.x(Java DSL)。我有兴趣在我的
IntegrationFlow
中实现一个过滤器,它具有以下逻辑:
我对过滤器本身的最佳尝试:
public class FruitFilter {
@Filter
public boolean fruitsOnly(Message<?> message) {
return message.getHeaders().containsKey("fruit");
}
}
我在流程中使用此过滤器的最佳尝试:
@Bean
public IntegrationFlow fruitFlow() {
return IntegrationFlows.from(ingressChannel())
.filter(fruitFilter)
// TODO #1: how to route messages (containing the fruit header) on to the "fruit-channel"?
// TODO #2: how to process messages that were filtered and sent to the discard/DLQ channel?
.get();
}
我认为 Java 代码和 Spring Integration 的 API 的使用在上面是可以的,但我不明白我在哪里/如何放置实际的基于过滤器的routing。任何人都可以发现我在这里出错的地方吗?提前致谢!