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

Four Stars

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)?
Ten Stars

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

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.
Four Stars

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

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");
Ten Stars

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

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 :-)

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read