in spring cloud stream 3.2.3, how to Manually Handle Null Payload manually

Options
preSend or extending AbstractMessageHandler did not work,
And @StreamListener annotation is deprecated

How to handle it, without changing any versions

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 921 admin
    Options

    Hi @Kitrakrev,

    As you've probably seen, a Spring Message does not allow for a null payload. Because of this exact issue we added support in our Binder in v3.3.0 of the "Solace Spring Cloud Stream Starter" (back in March 2022) where the payload is empty but a header is marked as null. Unfortunately, without upgrading to v3.3.0 or newer I'm not sure there is much you can do. I would recommend upgrading to 3.3.0 or even 3.5.0 which is the latest minor version upgrade. With a minor version upgrade you should not see backwards breaking changes.

    You can find releases here: https://github.com/SolaceProducts/solace-spring-cloud/releases

    Once you upgrade you can identify null payloads as defined in the docs here: https://github.com/SolaceProducts/solace-spring-cloud/tree/master/solace-spring-cloud-starters/solace-spring-cloud-stream-starter#empty-payload-vs-null-payload

  • Kitrakrev
    Kitrakrev Member Posts: 2
    edited November 2023 #3
    Options

    Hi @marc is there a way to intercept the message before it is received or after handled by solace, and retry again with updated message?