Solace Spring Cloud Stream Function (Processor pattern) with StreamBridge
I researched and found StreamBridge to be the current way to implement such arbitrary message sending. But when I tried doing so (add new producer config i.e. "solace.bindings.<binding-name>.producer.<queueNameExpression, etc.>", when streamBridge.send() is hit in SCS Processor flow, the message still gets sent to the consumer queue.
Previous style of implementations I saw for such usecase involve @StreamListener which as I've read is now a deprecated SCS feature so I wouldn't try that out anymore.
With this, I'm not sure whether it is really possible to combine both SCS Processor and Streambridge together. If anyone has ideas, I'll appreciate any thoughts towards my above usecase. Thanks!
Comments
-
Hi @seph,
With
StreamBridge
you don't actually have to pre-configure the binding ahead of time. So within your processor which has it's regular input/output bindings you can just saystreamBridge.send(topic, payload);
See if that gives you what you need :)
Here is an example using StreamBridge with aConsumer
function, but it should work just the same inside of aFunction
one:1 -
Hi @marc,
Thanks a lot for the insights. Really helped establishing a baseline implementation. I was able to determine the actual behavior that was happening in my application through thorough debugs.
First, it is indeed possible to use Function<?,?> and StreamBridge together.
Next I've noticed is that only when the application throws an Exception within the Stream, is when the message is sent back to consumer queue. I'll have a look into the Error Handling for SCS and Solace specific implementation for this.
Lastly, the Exception encountered is happening within the implementation for StreamBridge. See
Wherein I was using streamBridge.send("bindingName-out-0", java-object). To resolve, I resorted to convert java object to byte array before sending.
1