Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor editorial changes

...

This example is located in the Camel distribution at examples/camel-example-console.

This is a beginner's example that demonstrates how to get started with Apache Camel.

In this example we integrate with the console using the Stream component. The example is an interactive example that - it reads input from the console, and then transforms the input to upper case and print prints it back on to the console.

This is implemented in with a Camel route , defined in a the Spring XML file as markup shown below.:

Wiki Markup
{snippet:id=e1|lang=xml|url=camel/trunk/examples/camel-example-console/src/main/resources/META-INF/spring/camel-context.xml}

This example can be run launched from the command line using Maven with the following command:

Code Block
mvn compile exec:java

In the console you can enter a message and press ENTER<ENTER>. And then Camel responds with by echoing the input message in upper case, as shown below:

Code Block
[onsole.CamelConsoleMain.main()] SpringCamelContext             INFO  Apache Camel 2.10 (CamelContext: camel-1) started in 0.455 seconds
Enter something: camel rocks
CAMEL ROCKS
Enter something: and we have fun
AND WE HAVE FUN
Enter something: 

To stop the example hit ctrl + c, strike Control+C

You can also run this example from your editor. For example, from Eclipse you can import this project using: File -> Import ... -> → Import … → Existing Maven Project -> , and select the pom.xml from the examples\camel-example-console directory.

And then open Next, navigate to the org.apache.camel.example.console.CamelConsoleMain class, and right-click: , and select Run As -> Java Application.

Tip

Click on the screenshot below, to make it bigger.

...