I would like to have a binding that connects to a specific queue/topic and routes to the right function based on a specific header entry.
I could not find any example for this case. I have tried several approaches, but with none of them I had success.
This for example didn't work:
spring:
cloud:
function:
routing:
enabled: true
stream:
function:
routing:
enabled: true
definition: myConsumer;myOtherConsumer;
bindings:
myConsumer-in-0:
destination: myTopic
group: myGroup
binder: myBroker
routing-expression: "headers['MyRoutingInfo'] == 'even' ? 'myEvenConsumer' : 'myOddConsumer'"
myOtherConsumer-in-0: #without specific routing
Every concrete example is appreciated
I finally found a way to achieve my goal. But I'm not sure wheter this is THE way to do it:
with the following beans: