Camel / Red Hat Fuse


Apache Camel is a piece of JBoss Fuse.  It is an open source integration framework with a variety of components to fit your integration needs.  Camel is a Java-based implementation of the Enterprise Integration Patterns based on a book by Gregor Hohpe and Bobby Woolf.  Camel includes components for HTTP, Files, FTP, JMS, JDBC, AWS, and much more.  While Camel can be used for many different purposes, this post will focus on the REST DSL specifically.

Rest DSL Overview

Apache Camel provides a quick and easy way to get REST endpoints up and running without a dependency on CXF by using the Rest DSL.  Red Hat support for the Rest DSL came with the release of JBoss Fuse 6.2. Before Camel 2.15, most Rest implementation was done using the CXFRS Camel component.  While the CXFRS component did its job, many found it complex and confusing.  It required more files to be maintained than the new Rest DSL and made the application dependent on CXF.  The following Camel components support the use of the Rest DSL:

  • camel-coap
  • camel-netty-http
  • camel-netty4-http
  • camel-jetty
  • camel-restlet
  • camel-servlet
  • camel-spark-rest
  • camel-undertow

Rest DSL Syntax

As with any Camel route, if using the Java DSL, the class must extend the RouteBuilder class and implement a configure() method to form the route definition. One must specify which Camel component the route should use in the restConfiguration() call.  In this configuration, the servlet component is being used.  The binding mode is set to enforce the use of json.  You can leave it as auto so that the rest endpoint can process json, xml, or something else.  Next, the endpoint can be defined.  The root URL will be defined in using syntax like rest ("/user").  Then you can specify what type of call can be made to the endpoint: GET, PUT, POST, or DELETE. What the endpoint produces and consumes may also be defined in addition to defining what type of object the endpoint is expecting to be produced or consumed.  From there, the route is defined the same as any other Camel route.

 public void configure() throws Exception {


         .log("GET /user/${} request received!")

         .log("POST /user/ request received!")

         .log("DELETE /user/${} request received!")

Rest DSL on JBoss EAP

In order to get your Rest DSL Camel route running properly on EAP using CDI, you will need to add a servlet to the web.xml.  Please note the camel-servlet is the only supported way of using the Rest DSL with CDI on JBoss EAP at the current time.  If you want to use the Rest DSL with Spring on EAP I would suggest packing the Camel jars in your war.  If you choose to use CDI, the only edits needed are to the web.xml and then an additional annotation on your route class.


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns=""


   <!-- Camel Servlet -->

   <!-- Camel Servlet Mapping -->

route class

public class RestRoutes extends RouteBuilder {}

Rest DSL on JBoss Fuse Karaf

In order to get your Rest DSL route running on Karaf, you will need to have a camel-context.xml file.  Aside from this file, you will need to have proper import-packages and export-packages configured for your bundle.  This is a standard OSGi configuration.  See the JBoss Fuse documentation for more information on import and export packages.


<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=""
 xmlns:xsi="" xmlns:cm=""
 xmlns:jaxws="" xmlns:camel=""

   <!-- The camel context which registers the route -->
   <camel:camelContext id="fusequickstart-restdsl-camel" xmlns="">
      <!-- Package Scanning finds the Routes -->


These examples and more can found in full at

Last updated: February 23, 2024