이 콘텐츠는 선택한 언어로 제공되지 않습니다.

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:
  1. Open the simple-route project you created in the section called “Creating the Fuse project”.
  2. In Project Explorer, select simple-route/src/main/resources/META-INF/spring/camelContext.xml .
  3. Right-click it to open the context menu, then select Run As Local Camel Context (without tests).
    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 
    Copy to Clipboard Toggle word wrap
    indicates the route executed successfully.
  4. To shutdown the route, click the red square ( console's shutdown route button ) located at the top, right of the Console panel.

Verifying the route

To verify that the route executed properly:
  1. In Project Explorer, select simple-route.
  2. Right-click it to open the context menu, then select Refresh.
  3. In Project Explorer, locate the folder target/messages/ and expand it, as shown in Figure 2.1.

    Figure 2.1. Target message destinations in Project Explorer tree

  4. Verify that the target/messages/ subfolders contain these files:
    • uk/message1.xml
    • others/message2.xml
  5. 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

    <?xml version="1.0" encoding="UTF-8"?>
    
    <person user="james">
      <firstName>James</firstName>
      <lastName>Strachan</lastName>
      <city>London</city>
    </person>
    Copy to Clipboard Toggle word wrap

Further reading

To learn more about:
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat