Basically when camel consumer is create, it already has a processor
which holds the whole route pipeline, your customer event consumer[1][2]
just need to call the processor.process(exchange) when you get the event.
If your under layer dll has threads to call the onMessageRecieved
callback method, I think you component can work with Camel.
You just need to make sure your callback method can pass the exchange
into processor which is set when the consumer is created.
[1]http://camel.apache.org/writing-components.html
[2]http://camel.apache.org/event-driven-consumer.html
Willem
vcheruvu wrote:
Hi,
I have an old java application that loads dll (native) to connect to third
party vendor. This dll will synchronously invoke onMessageRecieved callback
method at java side when there is an event and converts bytes to strings.
I am trying to investigate if I can write custom Camel Component that will
create custom endpoint which loads the dll to connect to third party vendor.
Then customConsumer extends default camel consumer that will have
onMessageReceived callback method which will be invoked by dll. Is this the
correct way to implement custom camel component? or rather achievable? Are
there any examples on using dll in camel route ?
Example:-
<from uri="customComponent:[dll file to
load]?callbackMethod="onMessageRecieved"/>
<convertBodyTo type="java.lang.Byte"
<to uri="beanName:covertBytesToString"/>
Kind regards,
-Vid-