null payload close the consumer flow receiver

Options

Hi All, I am using cloud stream lib for message consuming from solace.
If the inbound message has 'null' payload, then InboundXMLMessageListener.xmlMessageMapper.map(bytesXMLMessage) throws SolaceMessageConversionException.
And as a result, it ends with "Closing flow receiver to destination ...". And no further messages are received.
Kindly suggest how can I avoid this

Tagged:

Comments

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

    Hi @DeepakSoni12,
    Thanks for bringing this to our attention. It sounds like you may have found a bug. Is it possible for you to share your project with me? I tried to recreate this in my environment, but the app just logged "XMLMessage 28 has no payload" and continued listening for more messages. It would be useful to see how you're sending messages with a null payload as well as your receiver function (is it imperative or reactive?)

    -Marc

  • DeepakSoni12
    DeepakSoni12 Member Posts: 4
    Options

    Hi @marc ,
    Thank you very much for your reply.
    1. I am publishing the messages with a null payload via postman. (to http://localhost:9000/TOPIC/sensor/temperature/asd)
    I tried to extract the code here https://github.com/deepaksoni12/solace_demo/tree/develop
    Thank you
    Deepak

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

    Hi @DeepakSoni12,
    Thanks for sharing that! I was able to reproduce the issue with your code and will bring it to the attention of our R&D team and see if we can eventually get it fixed. I agree that receiving a null payload in a message shouldn't cause the app to shutdown. That said, this is the old way of using Spring Cloud Stream (with @StreamListener) and starting in Spring Cloud Stream v3 it is recommended to use Spring Cloud Function to implement your apps instead. When using Spring Cloud Function this issue doesn't seem to exist and the app continue to listen for more messages. Due to the framework as a whole moving to Spring Cloud Function (which actually allows for less messaging logic in the code) and the bug not existing when using that model I would recommend using that instead.

    I have a quick Spring Cloud Stream Basics codelab here that will walk you through getting started.

  • DeepakSoni12
    DeepakSoni12 Member Posts: 4
    Options

    Hi @marc ,
    Thank you very much for your time.
    I will definitely have a look at Spring Cloud Function. Thanks for sharing the link.
    Greetings!

  • DeepakSoni12
    DeepakSoni12 Member Posts: 4
    Options

    Hi @marc,
    As suggested, I have used the Spring Cloud Function and the null payload issue is there as well.
    " I was able to reproduce the issue with your code and will bring it to the attention of our R&D team and see if we can eventually get it fixed."

    Have you any updates to share from R&D team about this?

    Thank you!

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

    Hi @DeepakSoni12,
    Thanks for following up with me on this! I opened an issue on our solace-spring-cloud github repo. A fix has been implemented and will be included in the next release. More info can be found on github issue #54

  • Kaliappans
    Kaliappans Member Posts: 24
    Options

    I am also facing same issue with Solace when used with Spring cloud stream. It is not able to handle NULL payload. Please let me know the fix version in Spring Cloud Stream API

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

    Hi @Kaliappans,

    What version of spring-cloud-starter-stream-solace are you using? This was resolved over a year ago :)

  • Kaliappans
    Kaliappans Member Posts: 24
    Options

    @marc

    we are using below dependency in our microservice. Please let me know the fix version

    <dependency>

       <groupId>com.solace.spring.cloud</groupId>
    
       <artifactId>spring-cloud-starter-stream-solace</artifactId>
    
       <version>3.2.1</version>
    
    </dependency>
    

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

    Hi @Kaliappans,

    Here is a link that goes to the latest version for people that find this in the future. https://github.com/SolaceProducts/solace-spring-cloud/tree/master/solace-spring-cloud-starters/solace-spring-cloud-stream-starter#using-it-with-maven

    The current latest version is as follows:

    <!-- Solace Spring Cloud Stream Binder -->
    <dependency>
    <groupId>com.solace.spring.cloud</groupId>
    <artifactId>spring-cloud-starter-stream-solace</artifactId>
    <version>4.1.0</version>
    </dependency>

    Hope that helps.