If you want to deploy your routes in a blueprint configuration file, you must
first install the camel-blueprint
feature (it is not installed by
default). To install the camel-blueprint
feature, enter the following
console command:
karaf@root> features:install camel-blueprint
If you have an existing Fuse Mediation Router XML configuration file, you can deploy the routes by copying the configuration file into the following hot deploy directory:
InstallDir
/deploy
After deploying, the configured routes start up immediately.
For a detailed example of hot deployed routes, see JMS Endpoints in a Router Application.
You can hot deploy Fuse Mediation Router routes using either of the following types of configuration file:
You can deploy a camelContext
using a Spring configuration file,
where the root element is a Spring beans
element and the
camelContext
element is a child of the beans
element.
In this case, the camelContext
namespace must be
http://camel.apache.org/schema/spring
.
For example, the following Spring configuration defines a route that generates
timer messages every two seconds, sending the messages to the
ExampleRouter
log (which get incorporated into the console log
file,
):InstallDir
/data/log/servicemix.log
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="timer://myTimer?fixedRate=true&period=2000"/> <to uri="log:ExampleRouter"/> </route> </camelContext> </beans>
It is not necessary to specify schema locations in the configuration. But if you are editing the configuration file with an XML editor, you might want to add the schema locations in order to support schema validation and content completion in the editor. For the preceding example, you could specify the schema locations as follows:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> ...
Before deploying routes in a blueprint configuration file, check that the camel-blueprint feature is already installed.
You can deploy a camelContext
using a blueprint configuration file,
where the root element is blueprint
and the camelContext
element is a child of the blueprint
element. In this case, the
camelContext
namespace must be
http://camel.apache.org/schema/blueprint
.
For example, the following blueprint configuration defines a route that generates
timer messages every two seconds, sending the messages to the
ExampleRouter
log (which get incorporated into the console log
file,
):InstallDir
/data/log/servicemix.log
<?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="timer://myTimer?fixedRate=true&period=2000"/> <to uri="log:ExampleRouter"/> </route> </camelContext> </blueprint>
Note | |
---|---|
Blueprint is a dependency injection framework, defined by the OSGi standard, which is similar to Spring in many respects. For more details about blueprint, see The Blueprint Container. |