Apache Camel logo

Rest services are becoming more and more popular for communication between systems.  Now that Red Hat supports the use of Red Hat JBoss Fuse with Apache Camel Spring Boot, learn how you can get started with the Rest DSL and Spring Boot.  These directions will use the camel-servlet component, although various components can be used.

As with all Spring Boot projects, you will first need a class to start up the application:

public class SampleCamelApplication {
  * A main method to start this application.
  public static void main(String[] args) {
    SpringApplication.run(SampleCamelApplication.class, args);

  public ServletRegistrationBean camelServletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/camel/*");
    return registration;

Next you can write your camel route.  This example extends the RouteBuilder class:

public class SampleCamelRouter extends RouteBuilder {
  public void configure() throws Exception {

      .log(LoggingLevel.INFO, "Hello World")
      .transform().simple("Hello World");

Now you can run your example from the command line using mvn spring-boot:run. Then you can see if your service is working by hitting the following url: http://localhost:8080/camel/hello

Come out to my workshop with Claus Ibsen at Red Hat Summit to learn more about the Rest DSL, how to deploy this route (and more) to Red Hat OpenShift, and how to use 3scale by Red Hat to manage your APIs.

Last updated: March 18, 2024