Ganesh,
Injecting the client the way you are doing should work. The only
thing I can think of: could you try with #jbi instead of jbi in the
client declaration? If that still doesn't work, could you post us the
stacktrace that you're seeing?
Second question though: why do you want to inject a ServiceMix client
in there? If you want to access another service, wouldn't it be much
easier to just create a second route in your Camel routebuilder
(from("direct:b").to("jbi:endpoint:...") and then send a Camel
exchange to the "direct:b" endpoint?
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
2009/4/9 navigator09 <[email protected]>:
>
> Hi,
>
> I am trying to access ComponentContext inside servicemix-camel. I tried the
> following two approaches
>
> 1. created the following property inside the class which implements the
> route builder
>
> private javax.jbi.component.ComponentContext context;
>
> public void setContext(ComponentContext context) {
> this.context = context;
> }
> Expecting the dependency to be injected into the class extending the route
> builder as suggested by some forums. But it did not work.
>
> 2. I tried the following configuration with the xbean.xml of the camel
>
> <bean id="JobPollerService" class="poller.service.JobPollerService">
> <property name="servicemixclient" ref="client" />
> </bean>
>
> <bean id="client"
> class="org.apache.servicemix.client.DefaultServiceMixClient">
> <constructor-arg ref="jbi" />
> </bean>
>
> and in the camel router I implemented the following method
>
> public static DefaultServiceMixClient client;
> public void setContext(DefaultServiceMixClient client) {
> log.debug("Injecting component context");
> this.client= client;
> }
>
> here it failed to create the bean client saying that the constructor is
> incorrect. what is the right way to access ComponentContext or to create
> servicemixclient inside the servicemix-camel component.
>
> Regards,
> Ganesh
> --
> View this message in context:
> http://www.nabble.com/How-to-access-ComponentContext-inside-servicemix-camel-tp22972903p22972903.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>