15 Running and deploying Camel

 

This chapter covers

  • Starting and stopping Camel safely
  • Adding and removing routes at runtime
  • Deploying Camel
  • Running standalone
  • Running in web containers
  • Running in Java EE servers
  • Running with OSGi
  • Running with CDI

In chapter 14, you learned all about securing Camel. We’ll now shift focus to another topic that’s important to master: running and deploying Camel applications.

We’ll begin with starting Camel. You need to fully understand how to start, run, and shut down Camel reliably and safely, which is imperative in a production environment. We’ll also review various options you can use to tweak the way Camel and routes are started. We’ll continue on this path, looking at how to dynamically start and stop routes at runtime. Your applications won’t run forever, so we’ll spend time focusing on how to shut down Camel safely.

The other part of this chapter covers various strategies for deploying Camel. We’ll take a look at five common runtime environments supported by Camel. Two other popular runtimes, Spring Boot and WildFly Swarm, are covered in chapter 7, where we discuss microservices.

As we discuss these topics, we’ll work through an example involving Rider Auto Parts: you’ve been asked to help move a recently developed application safely into production. The application receives inventory updates from suppliers, provided via a web service or files. Figure 15.1 shows a high-level diagram of the application.

15.1 Starting Camel

15.1.1 How Camel starts

15.1.2 Camel startup options

15.1.3 Ordering routes

15.1.4 Disabling autostartup

15.2 Starting and stopping routes at runtime

15.2.1 Using CamelContext to start and stop routes at runtime

15.2.2 Using the Control Bus EIP to start and stop routes at runtime

15.2.3 Using RoutePolicy to start and stop routes at runtime

15.3 Shutting down Camel

15.3.1 Graceful shutdown

15.4 Deploying Camel

15.4.1 Embedded in a Java application

15.4.2 Embedded in a web application

15.4.3 Embedded in WildFly

15.5 Camel and OSGi

15.5.1 Setting up Maven to generate an OSGi bundle

15.5.2 Installing and running Apache Karaf

15.5.3 Using an OSGi Blueprint-based Camel route

15.5.4 Deploying the example

15.5.5 Using a managed service factory to spin up route instances

15.6 Camel and CDI

15.7 Summary and best practices

sitemap