[ 
https://issues.apache.org/jira/browse/CAMEL-25957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131133#comment-18131133
 ] 

Claus Ibsen commented on CAMEL-25957:
-------------------------------------

Fixed in PR https://github.com/apache/camel/pull/28372

_Claude Code on behalf of davsclaus_

> camel-azure-servicebus - the consumer gives the body as a BinaryData that 
> converts only to a String, so an unmarshal, a file or another producer after 
> it fails
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25957
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25957
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-azure-servicebus
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> The azure-servicebus consumer sets the body to the BinaryData of the received 
> message ({{ServiceBusConsumer}}, main e6885df7894d, line 252), and the 
> component converts a BinaryData only to a String ({{ServiceBusTypeConverter}} 
> has {{toString(BinaryData)}} and {{toBinaryData(String)}}). There is no 
> converter to a byte[] or an InputStream, so a route that reads the message as 
> data, or writes it, fails:
> * {{unmarshal: json}} after the consumer: 
> {{NoTypeConversionAvailableException: No type converter available to convert 
> from type: com.azure.core.util.BinaryData to the required type: 
> java.io.InputStream}};
> * {{to: file:...}}: {{GenericFileOperationFailedException: Cannot store file: 
> ... No body available of type: java.io.InputStream but has type: 
> com.azure.core.util.BinaryData}};
> * {{convertBodyTo: byte[]}}: {{InvalidPayloadException: No body available of 
> type: byte[] but has type: com.azure.core.util.BinaryData}}.
> Checked on 4.24.0-SNAPSHOT with a BinaryData body and the converters of 
> camel-azure-servicebus on the classpath; no broker is needed, as the consumer 
> gives this body for every message. Such a route needs {{convertBodyTo: 
> String}} first. The documentation says "In the consumer, the returned message 
> body will be of type String" ({{azure-servicebus-component.adoc}} line 93).
> *Proposed change*: add converters from BinaryData to byte[] ({{toBytes()}}) 
> and to InputStream ({{toStream()}}), and say in the documentation that the 
> body is a BinaryData.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to