Is there a way that we can discard a message from within a Spring Integration Service Activator that is defined using the Spring Integration DSL .handle()
method?
More specifically, assuming the below IntegrationFlow definition...
public IntegrationFlow sampleFlow() {
return IntegrationFlows
.from("someChannel")
.handle(someServiceClass::someMethod)
.get();
}
Is there a way to have a message discarded based on some evaluation within the someMethod
definition? Ideally, I would like to perform some logging and then discard.
I have found is that returning null
from someMethod
seems to effectively end the flow but I am not sure if this is the most graceful/correct solution. If this is the recommended solution, that is fine.