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

Options

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

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

    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!

  • nbommidi
    nbommidi Member Posts: 9
    Options

    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

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

    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

  • nbommidi
    nbommidi Member Posts: 9
    Options

    Hi @marc,

    Is there any plan in the future to enable this support ? i.e. Spring cloud stream sending the message as XML content. In an enterprise environment, there would be a lot of producers and consumers exchanging the messages in legacy mode and we can't enforce to change all of them at one time. Currently we can only move to spring cloud stream, if both producer and consumer apps are planning to upgrade. The adaptation of spring cloud would be severely limited due to this constraint.

  • keewilli
    keewilli Member Posts: 1
    Options

    We too have an abundance of legacy queues we publish to which are consuming the XML Content portion of the message. Interestingly, Spring Cloud Stream has no problem to read an incoming message with legacy XML Content. A hybrid app which sends messages using JmsTemplate with connection factory prop text-msg-xml-payload=true and receives messages using Spring Cloud Stream seems to work fine. Will eagerly await the day I can do some magic configuration in Spring Cloud Stream so outgoing TextMessages can use the legacy XML Content....