> On 31 Dec 2022, at 10:16, Babak Vahdat <babak.vah...@swissonline.ch.INVALID> 
> wrote:
> 
> Hi
> 
> Azure Servicebus makes use of Qpid Proton-J as the underlying messaging 
> library which support a predefined set of object types for the body and 
> headers of a given EventData object through the AMQP protocol:
> 

Sorry for the typo, with Azure Servicebus I actually meant Azure Event Hubs :-)

And this issue is also relevant in this context which I have been looking into

https://github.com/Azure/azure-sdk-for-java/issues/31095 
<https://github.com/Azure/azure-sdk-for-java/issues/31095>

Once fixed, then we need to adjust the Camel codebase as well so that you get a 
better hint about the header / payload not being supported by the underlying 
AMQP transport, e.g. here:

https://github.com/apache/camel/blob/camel-3.20.0/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/operations/EventHubsProducerOperations.java#L155
 
<https://github.com/apache/camel/blob/camel-3.20.0/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/operations/EventHubsProducerOperations.java#L155>


> https://learn.microsoft.com/en-us/java/api/com.azure.messaging.eventhubs.eventdata?view=azure-java-stable
>  
> <https://learn.microsoft.com/en-us/java/api/com.azure.messaging.eventhubs.eventdata?view=azure-java-stable>
> 
> So if any header in the payload or the body type itself is not supported then 
> this is what you get. In this case it's the body itself which is the 
> HttpServletRequest implementation of the underlying Tomcat server you make 
> use of. So maybe try to make use of Message Translator EIP:
> 
> https://camel.apache.org/components/latest/eips/transform-eip.html 
> <https://camel.apache.org/components/latest/eips/transform-eip.html>
> 
> To have the right content as body before sending the payload to Azure 
> Servicebus:
> 
> .transform(simple("${body.getInputStream()}"))
> 
> Which would correspond to calling:
> 
> https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/connector/RequestFacade.html#getInputStream()
>  
> <https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/connector/RequestFacade.html#getInputStream()>
> 
> Or optionally convert it afterwards to String if you want:
> 
> .convertBodyTo(String.class)
> 
> In case you run into a similar issue with any of the HTTP headers, then see 
> this FAQ:
> 
> https://camel.apache.org/manual/faq/how-to-avoid-sending-some-or-all-message-headers.html
>  
> <https://camel.apache.org/manual/faq/how-to-avoid-sending-some-or-all-message-headers.html>
> 
> —
> Babak
> 
>> On 29 Dec 2022, at 15:24, Tushar Pattanayak <tusharpatw...@gmail.com> wrote:
>> 
>> Hi,
>>    I posted this to stackoverflow and didn't get any response yet.
>> 
>> https://stackoverflow.com/questions/74936096/camel-azure-event-hub-issue
>> 
>> Can someone please give your inputs about this ?
>> 
>> versions :-
>> spring-boot - 2.7.8
>> camel-spring-boot - 3.18.2
>> camel -azure-eventhubs - 3.18.2
>> camel-servlet-starter - 3.18.2
>> 
>> Thanks,
>> Tushar
> 

Reply via email to