此内容没有您所选择的语言版本。

Chapter 7. Editing a routing context in the route editor


Developing an Apache Camel application typically consists of the following tasks:
  1. Adding one or more routes to the routing context.
  2. Adding a starting point pattern to a route.
  3. Adding one or more endpoint patterns to a route.
  4. Adding one or more processor patterns that represent how messages will be transformed and routed between the starting point and endpoint(s).
  5. Connecting the patterns (referred to as nodes once they are placed on the canvas).
  6. Configuring the details for each of the endpoints and processors that make up the route.
  7. Adding any configuration beans to the context.

7.1. Adding routes to the routing context

Overview

The camelContext element within an XML context file creates a routing context. The camelContext element can contain one or more routes, but the route editor's canvas can display only one of the routes at a time. Therefore the canvas is each route's delineator, and each route displayed on the canvas maps to a route element in the generated camelContext element.
When you create a new Fuse Project, the tooling creates an example camelContext.xml file that is defined either as camel-context.xml (Spring) or blueprint.xml (Blueprint). You can view and edit the contents of the camelContext.xml file in the route editor's Source view. In Design view, the route editor presents an empty canvas, which represents the empty route element. You can drag patterns from the Palette and drop them onto the canvas to create a route. The design time tooling updates the empty route element with XML code generated from the patterns you drop onto the canvas.
The tooling provides three methods for adding a new route:
  • From the menu bar, by opening the Routes menu, and then selecting Add Route
  • In Design view, by right-clicking the canvas or a node to access the context menu, and then selecting Add Route
  • In Source view, by adding a <route/> element to the existing list within the camelContext element

Procedure

To add another route to the camelContext:
  1. Select one of the methods for adding a route.
    In Design view, a route icon appears in Outline view, and the Properties editor displays the list of the new route's properties for you to edit.
  2. In the Properties editor, enter an ID (for example, Route2) for the new route in the route's ID field.
    In Outline view, the new ID displays next to the new route icon.
  3. In the Properties editor, enter a description of the route in the Description field.
  4. On the menu bar, select File Save to save the changes you made to the routing context file.
Note
To switch between multiple routes, select the route you want to display on the canvas by clicking it in Outline view or by selecting it from the Routes menu on the menu bar.

Related topics

Red Hat JBoss Fuse Tooling Tutorials, To Add a Content-Based Router
Red Hat JBoss Fuse Tooling Tutorials, To Add Another Route to the CBR Routing Context
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.