spring-cloud-stream icon indicating copy to clipboard operation
spring-cloud-stream copied to clipboard

Be able to discard messages using the Function Router

Open th3n3rd opened this issue 3 years ago • 0 comments

Consider the following scenario:

Screenshot 2022-02-08 at 11 02 20

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.

th3n3rd avatar Feb 08 '22 10:02 th3n3rd