You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vcheruvu <vi...@macquarie.com> on 2010/04/21 17:21:35 UTC

native(dll) to java callback method in Camel

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-
-- 
View this message in context: http://old.nabble.com/native%28dll%29-to-java-callback-method-in-Camel-tp28288045p28288045.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: native(dll) to java callback method in Camel

Posted by Willem Jiang <wi...@gmail.com>.
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-