Try PubSub+

Using Spring cloud Stream, message is being sent as an attachment instead of content

hello, i am using org.springframework.cloud.stream.function.StreamBridge to send the message to a solace topic. Using the mime type as "text/plan". The message is being sent to queue. But as an attachment. The content size is zero bytes, but the attachment size is same as the message size I sent.

I couldn't find any documentation to enforce the message as content.

due to the subscribers aren't receiving any messages.

Any suggestions ?

i am using spring cloud stream framework with spring boot.

Comments

  • marcmarc Member, Administrator, Moderator, Employee Posts: 564 admin

    Hi @nbommidi,

    I think I understand what might be going on here. A Solace Message has two different parts of the message where a payload can be attached. The first is the Binary Attachment portion of the message, and the second is the XML Content part of the message which has hung around for legacy reasons. If you are developing new apps it is recommended to use the Binary Attachment part of the message to store your payload, which is what Spring Cloud Stream uses.

    What API are your apps that are consuming the messages using? My guess is that they are using a Solace SMF API such as JCSMP and are expecting the payload to be in the "XML Content" portion of the message? Can you have them try to receive the message as a BytesMessage and use the getData method to see if your content is in there as expected?

    Hope that helps!

  • nbommidinbommidi Member Posts: 5

    Thank You Marc for quick response. The subscriber application is an existing application. I am writing my application to produce the messages. when i observed it in the solace admin, the queue is showing the content size as "0" and Attachment Size as >0. Due to this the subscriber app is not getting any message. I need to find a way to publish the message as content. i am using StreamBridge.send(topic, data) method to publish

  • marcmarc Member, Administrator, Moderator, Employee Posts: 564 admin

    Hi @nbommidi,

    Spring Cloud Stream will not allow you to put the payload in the XML Content. If you absolutely have to do that and are using Spring then I'd look at using our Spring Boot JMS or Java starters.

    https://github.com/SolaceProducts/solace-spring-boot

Sign In or Register to comment.