Not able to access any of those solace specific headers,

akg17
akg17 Member Posts: 76
edited September 2021 in General Discussions #1
    @StreamListener("solace-test")
    public void onMessage(Message<String> message){
        Destination destination = message.getHeaders().get(SolaceHeaders.DESTINATION, Destination.class);
        System.out.println("DESTINATION :: " + destination.getName());
        System.out.println("MESSAGE " + message.getPayload());

        System.out.println("solace_correlationId " + message.getHeaders().get("solace_correlationId"));
        System.out.println("solace_destination " + message.getHeaders().get("solace_destination"));
        message.getHeaders().forEach((k,v)-> {
            System.out.println("KEY :: " + k + " Value " + v );
        });
    }

Also another question is does solace scs use JMSXDeliveryCount internally for any purpose?

Comments

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

    Hi @akg17,

    Also another question is does solace scs use JMSXDeliveryCount internally for any purpose?

    Easier question first: Nope, our Spring Cloud Stream binder does not use JMS and would ignore this property. You can set/get it just like any custom property.

    As for not being able to see the headers can you verify what Solace binder version you are using? To access the headers I believe you'll need the latest solace-spring-cloud which is v2.1.0. Example pom here

    Side note: Don't use @StreamListener anymore. That is the v2 way of things and was effectively deprecated in v3 of Spring Cloud Stream. Check out our samples here (or the Spring Cloud Stream reference guide) if you want to see the v3 way ;)

  • akg17
    akg17 Member Posts: 76

    2.1.0 bom is fine.. but, i am using spring boot 2.3.12 and Hoxton.SR12 above it i cant update due to some reason, and it requires version 2020.0.2 SCS