You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Calvert, Zach (Zach)** CTR **" <zc...@motive.com> on 2012/02/17 15:09:45 UTC
Startup Behavior Like ActiveMQ
I have a core bundle (bundle A) which sets up active MQ like:
<!-- Define the concurrency configuration for our queue -->
<bean id="routerQueueConfig" class="org.apache.camel.component.jms.JmsConfiguration">
.... configuration
</bean>
<!-- Define the router queue -->
<bean id="activemqrouter" class="org.apache.activemq.camel.component.ActiveMQComponent">
<!-- This config allows more than one request to be processed at a time -->
<property name="configuration" ref="routerQueueConfig"/>
</bean>
<!-- exposing the service -->
<osgi:service id="routerqueue" ref="activemqrouter" interface="org.apache.camel.Component"/>
Now in another bundle, I create a reference to the rouerqueue config:
<!-- reference handle to the queue for the router bundle -->
<osgi:reference id="routerqueue" interface="org.apache.camel.Component" />
And then I can directly use it in my routes:
<camel:route>
<camel:from uri="routerqueue:queue:bootstrap:in" />
...
</camel:route>
My question is, how do I make a component which supports the same behavior? I have created an implementation of the camel Component interface and configured it the same way as active MQ above, but when using it as the from/to sections on the route, the "createEndpoint" method is never called. What am I missing?
Thanks,
Zach Calvert
Re: Startup Behavior Like ActiveMQ
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
How did you expose your component as a service ?
You may do the things like this
<bean id="yourmq" class="YOUR_COMPONENT">
<!-- This config allows more than one request to be processed
at a time -->
<property name="configuration" ref="routerQueueConfig"/>
</bean>
<!-- exposing the service -->
<osgi:service id="routerqueue" ref="yourmq"
interface="org.apache.camel.Component"/>
On Fri Feb 17 22:09:45 2012, Calvert, Zach (Zach)** CTR ** wrote:
> I have a core bundle (bundle A) which sets up active MQ like:
> <!-- Define the concurrency configuration for our queue -->
> <bean id="routerQueueConfig" class="org.apache.camel.component.jms.JmsConfiguration">
> .... configuration
> </bean>
>
> <!-- Define the router queue -->
> <bean id="activemqrouter" class="org.apache.activemq.camel.component.ActiveMQComponent">
> <!-- This config allows more than one request to be processed at a time -->
> <property name="configuration" ref="routerQueueConfig"/>
> </bean>
> <!-- exposing the service -->
> <osgi:service id="routerqueue" ref="activemqrouter" interface="org.apache.camel.Component"/>
>
> Now in another bundle, I create a reference to the rouerqueue config:
> <!-- reference handle to the queue for the router bundle -->
> <osgi:reference id="routerqueue" interface="org.apache.camel.Component" />
> And then I can directly use it in my routes:
> <camel:route>
> <camel:from uri="routerqueue:queue:bootstrap:in" />
> ...
> </camel:route>
>
>
> My question is, how do I make a component which supports the same behavior? I have created an implementation of the camel Component interface and configured it the same way as active MQ above, but when using it as the from/to sections on the route, the "createEndpoint" method is never called. What am I missing?
>
>
> Thanks,
> Zach Calvert
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang