Spring Cloud Stream Binder - Sending Persistent Messages with StreamBridge

Good morning everyone,

using the spring-cloud-stream-binder-solace sending Messages via the StreamBridge, is there a possibility to send persistent Messages? "show client ... stats" only reports non-persistent messages beeing sent by the application.

Thank you guys for your support and have a great day!
Timo

Comments

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin
    edited February 2021 #2

    Hi @timob,
    The Spring Cloud Stream binder actually only supports sending of Persistent messages. When you look at the show client ... stats results keep in mind that they are from the perspective of the broker. So Received is actually received by the broker and sent by the application.

    I tested this quickly locally and see streambridge publishing Persistent messages via show client ... stats.

    Hope that helps!

  • timob
    timob Member Posts: 11

    Hi @marc ,
    Thank you for your quick reply. I unfortunately don't see any persistent messages yet via "show client ... stats". Which message object do you pass to the StreamBridge or how do you call the StreamBridge in your code?
    Best,
    Timo

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin

    Hi @timob,
    I'm just using this simple function and publishing to it using the "Try-Me" functionality in the PubSub+ Manager (publish to the uppercase-in-0 topic if you haven't configured the binding. But at the end of the day it shouldn't matter what you're sending. The Cloud Stream binder doesn't support direct messaging and will only publish Persistent messages. If you turn off the ability to "Send Guaranteed Messages" in your client-profile you'll even see that it fails to connect.

    Can you share a screenshot of what you're seeing from the show client XXXX stats command?

        @Bean 
        public Consumer<String> uppercase(StreamBridge sb){
            return v -> {
                System.out.println("Uppercasing: " + v);
                sb.send("foo/uppercase", v.toUpperCase());
                sb.send("foo/lowercase", v);
            };
        }