I have a java DSL based spring integration (spring-integration-java-dsl:1.0.1.RELEASE
) flow which puts messages through a Filter
to filter out certain messages. The Filter
component works okay in terms of filtering out unwanted messages.
Now, I would like to set either a discardChannel="discard.ch"
but, when I set the discard channel, the filtered out messages never seem to actually go to the specified discardChannel
. Any ideas why this might be?
My @Filter annotated class/method:
@Component
public class MessageFilter {
@Filter(discardChannel = "discard.ch")
public boolean filter(String payload) {
// force all messages to be discarded to test discardChannel
return false;
}
}
My Integration Flow class:
@Configuration
@EnableIntegration
public class IntegrationConfig {
@Autowired
private MessageFilter messageFilter;
@Bean(name = "discard.ch")
public DirectChannel discardCh() {
return new DirectChannel();
}
@Bean
public IntegrationFlow inFlow() {
return IntegrationFlows
.from(Jms.messageDriverChannelAdapter(mlc)
.filter("@messageFilter.filter('payload')")
...
.get();
}
@Bean
public IntegrationFlow discardFlow() {
return IntegrationFlows
.from("discard.ch")
...
.get();
}
}
I have turned on spring debugging on and, I can't see where discarded messages are actually going. It is as though the discardChannel
I have set on the @Filter
is not being picked up at all. Any ideas why this might be?