Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Alpha549
Creator II
Creator II

Talend ESB : Combine job and Route for API

Hello !

 

I'm able to implement APIs jobs, but now I want to better understand routes.

Here is a simple test API job : sending the response message "ping"

 

0683p000009M7Eu.png0683p000009M7Ez.png0683p000009M7El.png0683p000009M6zd.png

 

What I need : I am not sure I understood routes as they really are. I see it like a meta way to manage jobs or other message exchanges, but I think I might be wrong.

My goal here is to use a route to print a message in Talend console when the API URL is called. In the future I would like to be able to implement a load balancer, but for now I have to do simple things to understand how routes work.

 

I created this route :

 

0683p000009M7CQ.png0683p000009M6wm.png0683p000009M7F4.png0683p000009M7BI.png

 

How I do : to correct me if it's the proper way

 

The API job shown above is already running and working via my browser.

I run the route.

I get an error : already bind.....

 

So, is it possible to do what I want ?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

OK, you are nearly there. The thing you have not done considered is that routes are always on. Therefore they need something to trigger the processing. You can do this in several ways, but I will demonstrate this by triggering the route with a different URL. 

 

0683p000009M6qD.png

 

Notice the two cMessagingEndpoints. cMessagingEndpoint_1 is used to provide the trigger endpoint. This is shown below....

0683p000009M6qI.png
To trigger this, you simply need to call http://localhost:8088/hello with a web browser.

 

The cMessagingEndpoint_2 is where your service is called. I am simply calling a demo service from the net. My component looks like this....

0683p000009M6qN.png
Pay attention to the "?bridgeEndpoint=true" at the end of my api call. You need to add this to yours. It essentially tells your route that this api is being "bridged". Essentially an api to call an api.

 

The cProcessor component is simply used to print the result of the bridged api call. This is seen below...

0683p000009M6p1.png

 

I hope this helps

View solution in original post

7 Replies
Alpha549
Creator II
Creator II
Author

Up ! 0683p000009MACn.png

Anonymous
Not applicable

OK, you are nearly there. The thing you have not done considered is that routes are always on. Therefore they need something to trigger the processing. You can do this in several ways, but I will demonstrate this by triggering the route with a different URL. 

 

0683p000009M6qD.png

 

Notice the two cMessagingEndpoints. cMessagingEndpoint_1 is used to provide the trigger endpoint. This is shown below....

0683p000009M6qI.png
To trigger this, you simply need to call http://localhost:8088/hello with a web browser.

 

The cMessagingEndpoint_2 is where your service is called. I am simply calling a demo service from the net. My component looks like this....

0683p000009M6qN.png
Pay attention to the "?bridgeEndpoint=true" at the end of my api call. You need to add this to yours. It essentially tells your route that this api is being "bridged". Essentially an api to call an api.

 

The cProcessor component is simply used to print the result of the bridged api call. This is seen below...

0683p000009M6p1.png

 

I hope this helps

Alpha549
Creator II
Creator II
Author

Hello, I'm sorry for the late answer.

 

Unfortunatelly I get the same error :

 

java.net.BindException: Address already in use: bind
org.apache.camel.RuntimeCamelException: java.net.BindException: Address already in use: bind
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
	at org.apache.camel.main.Main.doStart(Main.java:139)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:170)
	at tutorial_project.routetest_0_1.RouteTest.run(RouteTest.java:214)
	at tutorial_project.routetest_0_1.RouteTest.runJobInTOS(RouteTest.java:329)
	at tutorial_project.routetest_0_1.RouteTest.main(RouteTest.java:299)
Caused by: java.net.BindException: Address already in use: bind
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Unknown Source)
	at sun.nio.ch.Net.bind(Unknown Source)
	at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
	at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:317)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.server.Server.doStart(Server.java:401)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:345)
	at org.apache.camel.http.common.HttpCommonEndpoint.connect(HttpCommonEndpoint.java:175)
	at org.apache.camel.http.common.HttpConsumer.doStart(HttpConsumer.java:54)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3705)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:4023)
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3958)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3878)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
	... 6 more

Job RouteTest terminé à 17:53 02/09/2019. [Code sortie=1]

This works with you API URL (dummy API) tough.. 

May this error be because I'm on the same computer....?

 

I also ran the API job first, and then ran the route, then went on the hello URL but error with my API...

Anonymous
Not applicable

You need to start the service first in the Studio, then switch to the Route and start that.

 

If that doesn't work can you share a screenshot of your service and your route (with configuration of your cMessagingEndpoints) and I will take a look.

Alpha549
Creator II
Creator II
Author

Hello, here is my configuration :

 

My REST API test job : the response is just "ping"

 

0683p000009M5ZG.png0683p000009M6mr.png0683p000009M6b4.png

0683p000009M6nB.png

 

It works and I let the job running.

 

0683p000009M6th.png

 

Now my route where I applied what you advised :

 

0683p000009M6tm.png0683p000009M6oN.png

 

Here I set the bridge :

 

0683p000009M6W9.png0683p000009M6tr.png

 

However, when I run the route, I get this error :

 

 

java.net.BindException: Address already in use: bind
org.apache.camel.RuntimeCamelException: java.net.BindException: Address already in use: bind
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
	at org.apache.camel.main.Main.doStart(Main.java:139)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:170)
	at tutorial_project.routetest_0_1.RouteTest.run(RouteTest.java:216)
	at tutorial_project.routetest_0_1.RouteTest.runJobInTOS(RouteTest.java:331)
	at tutorial_project.routetest_0_1.RouteTest.main(RouteTest.java:301)
Caused by: java.net.BindException: Address already in use: bind
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Unknown Source)
	at sun.nio.ch.Net.bind(Unknown Source)
	at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
	at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:317)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.server.Server.doStart(Server.java:401)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:345)
	at org.apache.camel.http.common.HttpCommonEndpoint.connect(HttpCommonEndpoint.java:175)
	at org.apache.camel.http.common.HttpConsumer.doStart(HttpConsumer.java:54)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3705)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:4023)
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3958)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3878)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
	... 6 more

 

 

0683p000009M9xp.png

 

Anonymous
Not applicable

Ah, I forgot to mention this. You will need to use a different port for your route. Start your web service using port 8088 and your route with port 8089 and try that. 

Alpha549
Creator II
Creator II
Author

This worked ! Now I can keep discovering Routes and C components !

Thanks a lot rhall_2_0 !!!!