spring-cloud-stream
spring-cloud-stream copied to clipboard
Be able to discard messages using the Function Router
Consider the following scenario:
Here there is a single destination
where all applications in a system publish their messages, let's call that destination all-messages
.
Our application might want to consume message of type B
and C
, but not A
.
Currently we can setup a function router that can dispatch message of type B
and C
to their own respective consumers, but there isn't a way right now for the router to effectively discard a message.
The same functionality could also be used to discard messages produced against a shared channel. Let's say we have the same setup and our application is now not only able to consume but also to contribute back with its own messages.
Let's say the application wants to produce a message of type D
into all-messages
, to allow other applications to consume it. This will also trigger again the function router unfortunately, as after it's published it will be seen as a new incoming message to be potentially consumed.
Having a /dev/null
destination could help solving these issues.