Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
Chapter 2. 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
- send messages through a route
- examine the messages received by the endpoints
Prerequisites 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
To complete this tutorial you will need the Apache Camel project created in Chapter 1, To Create a New Route.
Running the route 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
To run the route:
- Open the simple-route project you created in the section called “Creating the Fuse project”.
- In Project Explorer, select
simple-route/src/main/resources/META-INF/spring/camelContext.xml
. - Right-click it to open the context menu, then select
. The Console panel opens to display messages that reflect the progress of the project's execution. A message similar to the following[INFO] Using org.apache.camel.spring.Main to initiate a CamelContext [pache.camel.spring.Main.main()] MainSupport INFO Apache Camel 2.12.0.redhat-610062 starting [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610062 (CamelContext: camel-1) is starting [pache.camel.spring.Main.main()] ManagedManagementStrategy INFO JMX is enabled [pache.camel.spring.Main.main()] DefaultTypeConverter INFO Loaded 176 type converters [pache.camel.spring.Main.main()] SpringCamelContext 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 [pache.camel.spring.Main.main()] FileEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well [pache.camel.spring.Main.main()] FileEndpoint INFO Using default memory based idempotent repository with cache max size: 1000 [pache.camel.spring.Main.main()] SpringCamelContext INFO Route: route1 started and consuming from: Endpoint[file://src/data?noop=true] [pache.camel.spring.Main.main()] SpringCamelContext INFO Total 1 routes, of which 1 is started. [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610062 (CamelContext: camel-1) started in 0.354 seconds
[INFO] Using org.apache.camel.spring.Main to initiate a CamelContext [pache.camel.spring.Main.main()] MainSupport INFO Apache Camel 2.12.0.redhat-610062 starting [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610062 (CamelContext: camel-1) is starting [pache.camel.spring.Main.main()] ManagedManagementStrategy INFO JMX is enabled [pache.camel.spring.Main.main()] DefaultTypeConverter INFO Loaded 176 type converters [pache.camel.spring.Main.main()] SpringCamelContext 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 [pache.camel.spring.Main.main()] FileEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well [pache.camel.spring.Main.main()] FileEndpoint INFO Using default memory based idempotent repository with cache max size: 1000 [pache.camel.spring.Main.main()] SpringCamelContext INFO Route: route1 started and consuming from: Endpoint[file://src/data?noop=true] [pache.camel.spring.Main.main()] SpringCamelContext INFO Total 1 routes, of which 1 is started. [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610062 (CamelContext: camel-1) started in 0.354 seconds
Copy to Clipboard Copied! Toggle word wrap Toggle overflow indicates the route executed successfully. - To shutdown the route, click the red square (
) located at the top, right of the Console panel.
Verifying the route 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
To verify that the route executed properly:
- In Project Explorer, select
simple-route
. - Right-click it to open the context menu, then select.
Figure 2.1. Target message destinations in Project Explorer tree
- Verify that the
target/messages/
subfolders contain these files:uk/message1.xml
others/message2.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 2.1.Example 2.1. Contents of message1.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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/site/documentation/JBoss_Fuse/.
- deploying Apache Camel applications see Red Hat JBoss Fuse: Deploying into the Container that comes with Red Hat JBoss Fuse.