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:

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