Chapter 3. To Run a Route
Abstract
This tutorial walks you through the process of running a route.
Goals
In this tutorial you will:
- run a route as a local Apache Camel Context (without tests)
- send messages through the route
- examine the messages received by the endpoints
Prerequisites
To complete this tutorial you will need the CBRroute project created in Chapter 2, To Create a New Route.
Running the route
To run the route:
- Open the CBRroute project you created in the section called “Creating the Fuse project”.
- In Project Explorer, select
CBRroute/src/main/resources/OSGi-INF/blueprint/camelContext.xml
. - Right-click it to open the context menu, then select
. NoteIf you select Chapter 8, To Test a Route with JUnit tutorial, you will replace the supplied JUnit test with one you create for the this project.instead, the tooling automatically runs the routing context against the supplied JUnit test, and it will fail. In theThe Console panel opens to display log messages that reflect the progress of the project's execution. At the beginning, Maven downloads the resources necessary to update the local Maven repository, which may take a few minutes.Messages similar to the following indicate that the route executed successfully.[INFO] Starting Camel ... [mel.test.blueprint.Main.main()] MainSupport INFO Apache Camel 2.13.2 starting [mel.test.blueprint.Main.main()] Activator INFO Camel activator starting [mel.test.blueprint.Main.main()] Activator INFO Camel activator started [mel.test.blueprint.Main.main()] BlueprintExtender INFO No quiesce support is available, so blueprint components will not participate in quiesce operations [ Blueprint Extender: 1] BlueprintContainerImpl INFO Bundle cbr-route is waiting for namespace handlers [http://camel.apache.org/schema/blueprint] [ Blueprint Extender: 1] BlueprintCamelContext INFO Apache Camel 2.13.2 (CamelContext: blueprintContext) is starting [ Blueprint Extender: 1] ManagedManagementStrategy INFO JMX is enabled [heysmbp.home:1099/jmxrmi/camel] DefaultManagementAgent INFO JMX Connector thread started and listening at: service:jmx:rmi:///jndi/rmi://janemurpheysmbp.home:1099/jmxrmi/camel [ Blueprint Extender: 1] BlueprintCamelContext INFO AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance. [ Blueprint Extender: 1] BlueprintCamelContext INFO StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html [ Blueprint Extender: 1] FileEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well [ Blueprint Extender: 1] FileEndpoint INFO Using default memory based idempotent repository with cache max size: 1000 [ Blueprint Extender: 1] XPathBuilder INFO Created default XPathFactory com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@46e48d4 [ Blueprint Extender: 1] BlueprintCamelContext INFO Route: Route1 started and consuming from: Endpoint[file://src/data?noop=true] [ Blueprint Extender: 1] BlueprintCamelContext INFO Total 1 routes, of which 1 is started. [ Blueprint Extender: 1] BlueprintCamelContext INFO Apache Camel 2.13.2 (CamelContext: blueprintContext) started in 1.073 seconds
- To shutdown the route, click located at the top, right of the Console panel.
Verifying the route
To verify that the route executed properly:
- In Project Explorer, select
CBRroute
. - Right-click it to open the context menu, then select.
Figure 3.1. Target message destination in Project Explorer tree
- Verify that the
target/messages/others
folder contains the six message files,message1.xml
throughmessage6.xml
. - Double-click
message1.xml
to open it in the editor's Design view, then select the Source tab at the bottom, left of the canvas to see the xml code.It's contents should match that shown in Example 3.1.Example 3.1. Contents of message1.xml
<?xml version="1.0" encoding="UTF-8"?> <order> <customer> <name>Brooklyn Zoo</name> <city>Brooklyn</city> <country>USA</country> </customer> <orderline> <animal>wombat</animal> <quantity>15</quantity> <maxAllowed>25</maxAllowed> </orderline> </order>
Further reading
To learn more about:
- configuring runtime profiles, see Red Hat JBoss Fuse Tooling: JBoss Fuse Tooling User Guide at https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.2/html/Tooling_User_Guide/RiderEditRunProfile.html.
- deploying Apache Camel applications see Red Hat JBoss Fuse: Deploying into the Container.