RE: Passing parameters from routes to components
Re properties... Sure, there is a long description at http://camel.apache.org/properties.html There are a number of mechanisms for getting the properties injected, depending on how you package and deploy your application. Here is one discussion: http://stackoverflow.com/questions/19457818/how-do-i-load-a-camel-property-into-a-bean Also, I have some code that loads properties that are used in a route I define in Java DSL. Like this: public class Routes extends RouteBuilder { // URI to send requests to. @PropertyInject("backendUri") private String backendUri; private void validateNeededProperties() throws Exception { if (backendUri == null) throw new BadConfigurationException("backendUri is not set"); } @Override public void configure() throws Exception { validateNeededProperties(); ... from(INVOKE_BACKEND_URI).routeId(INVOKE_BACKEND_ROUTE_ID) .to(backendUri) -Steve > -Original Message- > From: Erol [mailto:e...@erol.si] > Sent: Friday, February 24, 2017 9:01 AM > To: users@camel.apache.org > Subject: RE: Passing parameters from routes to components > > Yes, can you please tell me more or do you maybe have an example? > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Passing- > parameters-from-routes-to-components-tp5794341p5794429.html > Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Passing parameters from routes to components
Yes, can you please tell me more or do you maybe have an example? -- View this message in context: http://camel.465427.n5.nabble.com/Passing-parameters-from-routes-to-components-tp5794341p5794429.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Passing parameters from routes to components
You could inject property values from outside the routes. > -Original Message- > From: Erol [mailto:e...@erol.si] > Sent: Thursday, February 23, 2017 6:01 AM > To: users@camel.apache.org > Subject: Passing parameters from routes to components > > Hello all > > I'm dynamically building routes. Route consists of multiple components. Data > for each component is saved in the database. > > Currently I have routes like this > > > cecf4dec-530d-4d4c-aa31-6f88f6c558d1 > > > > d507ba3e-aa5a-4047-b662-c8ab3abd1f2b > > headerName="databaseId"> > 6c8511cc-22fd-46e1-8333-70e4b8e2cda1 > > > > > Then in each component I access databaseid with @Header("databaseId") > and use this id to fetch data from database. > > This works, but I feel like I'm overusing headers. Is there a better way? > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Passing- > parameters-from-routes-to-components-tp5794341.html > Sent from the Camel - Users mailing list archive at Nabble.com.