Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
How Do I Configure Endpoints?There are a few different approaches to configuring components and endpoints. Using JavaYou can explicitly configure a Component using Java code as shown in this example Or you can explicitly get hold of an Endpoint and configure it using Java code as shown in the Mock endpoint examples. Using CDIYou can use CDI as dependency injection framework to configure your Component or Endpoint instances. For example, to configure the SJMS component, you can declare a producer method in a CDI bean: Then, the component is lazily looked-up by Camel CDI whenever it is referenced, e.g., from the Camel Java DSL: Besides, endpoints of that component can be injected in any CDI beans, e.g., Using GuiceYou can also use Guice as the dependency injection framework. For example see the Guice JMS Example. Using Spring XMLYou can configure your Component or Endpoint instances in your Spring XML as follows. Using Endpoint URIsAnother approach is to use the URI syntax. The URI syntax supports the query notation. So for example with the Mail component you can configure the password property via the URI Referencing Beans from Endpoint URIsFrom Camel 2.0: When configuring endpoints using URI syntax you can now refer to beans in the Registry using the Will lookup a bean with the id Configuring Parameter Values Using Raw Values, e.g., such as passwordsFrom Camel 2.11: When configuring endpoint options using URI syntax, then the values is by default URI encoded. This can be a problem if you want to configure passwords and just use the value as is without any encoding. For example you may have a plus sign in the password, which would be decimal encoded by default. From Camel 2.11: we made this easier as you can denote a parameter value to be raw using the following syntax In the above example, we have declare the password value as raw, and the actual password would be as typed, e.g., Using Property PlaceholdersCamel have extensive support for using property placeholders, which you can read more about here. For example in the ftp example above we can externalize the password to a For example configuring the property placeholder when using a XML DSL, where we declare the location of the .properties file. Though we can also define this in Java code. See the documentation for more details. And the Camel route now refers to the placeholder using the {{ key }} notation: And have a We could still have used the RAW(value) in the Camel route instead: And then we would need to remove the RAW from the properties file: To understand more about property placeholders, read the documentation. Configuring URIs using Endpoint with Bean Property StyleAvailable as of Camel 2.15 Sometimes configuring endpoint uris may have many options, and therefore the URI can become long. In Java DSL you can break the URIs into new lines as its just Java code, e.g., just concat the String. When using XML DSL then the URI is an attribute, e.g.,
In the example above, the endpoint with id foo, is defined using
Configuring Long URIs Using New LinesAvailable as of Camel 2.15 Sometimes configuring endpoint URIs may have many options, and therefore the URI can become long. In Java DSL you can break the URIs into new lines as its just Java code, e.g., just concat the String. When using XML DSL then the URI is an attribute, e.g., Notice that it still requires to use escape See Also |