Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
est412
Contributor II
Contributor II

Setting endpoint's IP for ?CXF as consumer (client) at runtime

Hello!
Could you show me the right way to set IP for ?CXF consumer (client) at runtime?
For example:
(Start) -> (get IP from DB) -> cCXF (using this IP) -> (print response)

Thank you!

P.S. I know how to use cRecipientList with hand-made edpoint URI, but is it possible to achive the same goal using cCXF component (may be with some additional components)?
Labels (2)
3 Replies
Anonymous
Not applicable

This is tricky as when you start the Talend Route everything needs to be set. A Talend Route is really a Camel Context (it is badly named). The Routes inside your Camel Context need to be stopped and restarted between changing values such as Endpoints. This can be done (I had to do it a long time ago and I am not sure I still have the code), but it requires Java coding and a lot of manipulating. I ended up creating dynamic routes in code and starting them and stopping them in code inside my Talend Route. This will not be easy.

An easier way to achieve this is to use context parameter files with your Routes and change the values (maybe using a Talend Job), then restart the Route inside the Karaf. When it restarts it will pick up the new context variable values.
1) Stop service.
2) Go to <Talend ESB runtime install path>\container\etc and create a file called yourservicename.cfg, edit the file as below:

varName1=newValue1;
varName2=newValue2;
3) Start service.
est412
Contributor II
Contributor II
Author

I'm sorry! 
I've just misnamed the type of endpoint. In terms of Camel it's not a "consumer", but a "producer".
And finally I've found the solution from camel-cxf website - to override producer endpoint address like this:
// set up the service address from the message header to override the setting of CXF endpoint
exchange.getIn().setHeader(Exchange.DESTINATION_OVERRIDE_URL, "dynamically created URL");
Anonymous
Not applicable

Ah I see, it's partly my mistake. I overlooked the bracket "client" which would have revealed it to me. So long as you have it sorted 🙂