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
To complete this tutorial you will need:
the Apache Camel project created in Creating a New Route
a FuseSource subscription
To test the route:
Open the Eclipse project created in Creating the Fuse IDE project.
Select
simple-route/src/main/resources/META-INF/spring/camelContext.xmlin the Project Explorer.From the context menu, select |.
The Console panel will open and messages reflecting the progress of the project execution will appear. When a message similar to the following
4 [main] INFO org.apache.camel.impl.MainSupport - Apache Camel 2.7.1-fuse-00-27 starting 45 [main] INFO org.springframework.context.support.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@45b9ce4b: startup date [Tue Apr 05 07:26:18 EDT 2011]; root of context hierarchy 114 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from URL [file:/workspace/demo/src/main/resources/META-INF/spring/camel-context.xml] 398 [main] INFO org.apache.camel.spring.handler.CamelNamespaceHandler - OSGi environment not detected. 951 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@29a7789c: defining beans [template,consumerTemplate,camel-1:beanPostProcessor,camel-1]; root of factory hierarchy 1153 [main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.7.1-fuse-00-27 (CamelContext: camel-1) is starting 1153 [main] INFO org.apache.camel.spring.SpringCamelContext - JMX enabled. Using ManagedManagementStrategy. 1584 [main] INFO org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 3 packages with 13 @Converter classes to load 1616 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 147 type converters in 0.292 seconds 1836 [main] INFO org.apache.camel.component.file.FileEndpoint - Endpoint is configured with noop=true so forcing endpoint to be idempotent as well 1836 [main] INFO org.apache.camel.component.file.FileEndpoint - Using default memory based idempotent repository with cache max size: 1000 1935 [main] INFO org.apache.camel.spring.SpringCamelContext - Route: route1 started and consuming from: Endpoint[file://src/data?noop=true] 1940 [main] INFO org.apache.camel.spring.SpringCamelContext - Total 1 routes, of which 1 is started. 1940 [main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.7.1-fuse-00-27 (CamelContext: camel-1) started in 0.787 secondsappears the route has been executed successfully.
To shutdown the route click the red square on the top of the Console panel.
To verify that the route executed properly:
Select
simple-routein the Project Explorer.From the context menu, select .
Locate the folder
target/messages/othersin the Eclipse Project Explorer.Verify that the folder contains two files:
message1.xmlmessage2.xml
Open
message1.xml.It's contents should match Example 2.1.
Example 2.1. Contents of the message
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <person user="james"> <firstName>James</firstName> <lastName>Strachan</lastName> <city>London</city> </person>
To learn more about:
configuring runtime profiles see Editing a Local Camel Context runtime profile in Using Fuse IDE.
deploying Apache Camel applications see the FuseSource Apache Camel library.







