🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
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