In this recipe, we'll introduce the power of the OSGi pattern ManagedServiceFactory interface to Apache Camel smart routers. This pattern will allow us to manage multiple service instances, or in our case, Camel routes, via configuration. In fact, we'll produce a new router instance for each configuration we supply our service factory!
The ingredients of this recipe include the Apache Karaf distribution kit, access to JDK, Maven, and a source code editor. The sample code for this recipe is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter2/chapter2-recipe6. Follow the instructions in the Installing Apache Camel modules into Apache Karaf recipe to provide the base requirements to operate the sample code.