Skip to content
Advertisement

Possibility of passing MyObject to bean routing using Apache camel?

I am consuming messages from Apache kafka using apache camel JAVA DSLs. I am writing an object by converting it to byte[] on kafka. when I consume it I receive a message back with byte[]. I deserialize it and get an object.

I checks it if it is an object of MyObject then need to pass it to bean using java DSL .to(). My code is as below:

JavaScript

Now issue is I just want MyObject in corresponding called method and I do not want to use TypeConvertors. I do not want to get Exchange/body in method I will process my stream in process and throw exception if read invalid messages and do not forward it to the bean.

My method on the other end will be:

JavaScript

Advertisement

Answer

Add @Body before function argument MessageBean msgObj:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement