One Star

deploy a route with a custom component reference in a cmessagingendpoi

I am trying to use the cMessagingEndpoint component to call the camel twitter component. This isn't included by default so I created a maven shade project to collect all the dependencies. Under the advanced settings for the cMessagingEndpoint I clicked "Use a custom component" and selected the jar from my maven project. This is working fine in the open studio however when I try and deploy the route .kar file to the container\deploy directory I get the following error below.
Where do I drop my camel twitter jar from my maven project? I've tried several of the lib directories with no luck.
karaf@trun> Failed to create route cMessagingEndpoint_1: Route[[From[twitter://streaming/sample?type=event&consumerKe... because of Failed to resolve endpoint: twitter://streaming/
sample?accessToken=asdf&accessTokenSecret=asdf&consumerKey=asdf&consumerSecret=asdf&type=event due to: No component found with scheme: twitter
org.apache.camel.FailedToCreateRouteException: Failed to create route cMessagingEndpoint_1: Route[[From[twitter://streaming/sample?type=event&consumerKe... because of Failed to resolve endpoint: twitter://streaming/sample?accessToken=asdf&accessTokenSecret=asdf&consumerKey=asdf&consumerSecret=asdf&type=event due to: No component found with scheme: twitter
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:173)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:709)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1733)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1525)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1420)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1388)
at osds_poc.queuetest_0_1.QueueTest$1CamelImpl.doStart(QueueTest.java:183)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at org.apache.camel.main.MainSupport.run(MainSupport.java:139)
at osds_poc.queuetest_0_1.QueueTest.Route(QueueTest.java:286)
at osds_poc.queuetest_0_1.QueueTest.runJobInTOS(QueueTest.java:394)
at org.talend.esb.job.controller.internal.RouteAdapter.run(RouteAdapter.java:78)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: twitter://streaming/sample?accessToken=asdf&ac
cessTokenSecret=asdf&consumerKey=bpUognsJmI6X91QXPWICEg&consumerSecret=asdf&type=event due to: No component found with scheme: twitter
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:461)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:183)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:89)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:833)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:168)
... 15 more

Thanks
Dan
4 REPLIES
Employee

Re: deploy a route with a custom component reference in a cmessagingendpoi

You don't really need to drop the twitter jar anywhere in particular. When you reference it from the Studio it should be copied to the correct location internally. and then exported - at least in theory. Here are two alternative suggestions.
First, try adding the cConfig component to the design palette. It does not need to be wired to anything. Use the Lib Path under Basic Settings in the Component tab on the bottom to select your jar. Remove the reference from the other location in the Custom Component, and give it another try in Studio to verify it is still works. Then try it the runtime.
If that does not work, you could try adding the Module view. I have not had success with this approach myself, but I was directed to it by R&D. Click on the View Menu, and under Talend select Modules. Add your jar to the list. You may want to revert to your original Custom component approach in combination with the Module approach.
One Star

Re: deploy a route with a custom component reference in a cmessagingendpoi

I tried both methods and got the same results each time. I did verify that the jar is included in the kar export though.
One Star

Re: deploy a route with a custom component reference in a cmessagingendpoi

Hello ,
I know this post is old , but i have a problem with using the camel component of twitter , i'm new to Talend ESB and i try to use the camel component of twitter in order to exctract data from the twitter api.
if you had already found the solution , can you give me please the steps in order to use this component.
One Star

Re: deploy a route with a custom component reference in a cmessagingendpoi

You can deploy custom Camel components as OSGI bundles into Karaf just by copying JAR file into context/deploy.

I used maven archetype to create project skeleton for my custom Camel component (see camel documentation). The archetype creates pom.xml with "bundle" packaging. When JAR file was created by mvn package I just dropped it into context/deploy.

After this the bundle was visible in osgi:list Karaf console command result and my Route using cMessagingEndpoint with my custom URI started working.

If you cannot get Twitter component as OSGI bundle, try to build it from scratch using maven archetype.
Good luck!