...
|
*Available as of Camel 2.13/2.12.3*
|
The *camel:hawtio* goal of the [Camel Maven Plugin] is used to run your Camel [Spring] configurations in a forked JVM from Maven. A good example application to get you started is the [Spring Example].
|
The *camel:hawtio* goal of the [Camel Maven Plugin] is an extension to [Camel Run Maven Goal] which is used to run your Camel [Spring] or [OSGi Blueprint|Using OSGi blueprint with Camel] configurations in a forked JVM from Maven.
|
|
A good example application to get you started is the [Spring Example].
|
{code} cd examples/camel-example-spring
|
mvn camel:run camel:hawtio
|
{code}
|
This makes it very easy to spin up and test your routing rules without having to write a main(…) method; it also lets you create multiple jars to host different sets of routing rules and easily test them independently.
|
This starts the example, and bootup the [hawtio|http://hawt.io/] web console by default on [http://localhost:8080/hawtio], which allows you to 'see' what happens with the Camel application running in the JVM. You can visualize the Camel routes in diagrams, as well see performance statistics, and debug or profile routes, and much more.
|
|
How this works is that the plugin will compile the source code in the maven project, then boot up a Spring ApplicationContext using the XML confiuration files on the classpath at
|
h3. Setting up camel:hawtio plugin
|
|
{code} META-INF/spring/*.xml {code}
|
In your Maven pom.xml file add the following plugin under plugins:
|
|
If you want to boot up your Camel routes a little faster, you could try the [camel:embedded|Camel Embedded Maven Goal] instead. h3. Running OSGi Blueprint From *Camel 2.10* onwards the {{camel:run}} plugin also supports running a [Blueprint|Using OSGi blueprint with Camel] application, and by default it scans for OSGi blueprint files in {code} OSGI-INF/blueprint/*.xml {code} You would need to configure the camel:run plugin to use blueprint, by setting useBlueprint to true as shown below
|
{code:xml} <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId>
|
<configuration> <useBlueprint>true</useBlueprint> </configuration>
|
</plugin> {code}
|
This allows you to boot up any Blueprint services you wish - whether they are Camel-related, or any other Blueprint. {info:title=Using limited Blueprint container} We use the [PojoSR project|https://code.google.com/p/pojosr/] as the blueprint container. This project is not a full fledged blueprint container. For that you can use [Apache Karaf|http://karaf.apache.org/] or [Apache ServiceMix|http://servicemix.apache.org/]. {info}
|
As the camel:hawtio plugin is an extension to the [Camel Run Maven Goal] it has the same options as the run plugin, and in addition the following:
|
|
You can use the {{applicationContextUri}} configuration to specify an explicit blueprint XML file, such as: {code:xml} <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <configuration> <useBlueprint>true</useBlueprint> <applicationContextUri>myBlueprint.xml</applicationContextUri> <!-- ConfigAdmin options which have been added since Camel 2.12.0 --> <configAdminPid>test</configAdminPid> <configAdminFileName>/user/test/etc/test.cfg</configAdminFileName> </configuration> </plugin> {code} The {{applicationContextUri}} will currently load the file from the classpath, so in the example above the myBlueprint.xml file must be in the root of the classpath. The {{configAdminPid}} is the pid name which will be used as the pid name for configuration admin service when loading the persistence properties file. The {{configAdminFileName}} is the file name which will be used to load the configuration admin service properties file. h3. Running CDI From *Camel 2.11* onwards the {{camel:run}} plugin also supports running a [CDI] application You would need to configure the camel:run plugin to use CDI, by setting useCDI to true as shown below {code:xml} <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <configuration> <useCDI>true</useCDI> </configuration> </plugin> {code} This allows you to boot up any CDI services you wish - whether they are Camel-related, or any other CDI enabled services. You should add the CDI container of your choice (e.g. Weld or OpenWebBeans) to the dependencies of the camel-maven-plugin such as [in this example|http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/]. From the source of Camel you can run a CDI example via {code} cd examples/camel-example-cdi mvn compile camel:run {code} h3. About DOT generation {{camel:run}} will by default try to run dot generation to generate [Visualisation] diagrams. This feature could in some rare cases cause the application to hang, so its by default disabled in Camel 1.6.1 or newer. To enable it you should configure the *useDot* parameter: {code:xml} <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <configuration> <useDot>true</useDot> </configuration> </plugin> {code} h3. Logging the classpath From *Camel 2.10* onwards you can configure whether the classpath should be logged when {{camel:run}} executes. In older releases the classpath is always logged. This can be verbose and noisy, so from Camel 2.10 onwards, the classpath is not logged anymore. You can enable this in the configuration using: {code:xml} <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <configuration> <logClasspath>true</logClasspath> </configuration> </plugin> {code}
|
|| Option || Default || Description || | port | 8080 | The port number to use for the hawtio web console. |
|