The Red Hat JBoss Fuse solution offers a new approach of ESB, both lightweight and modular. It is perfectly suited to allow you to implement light integrations.
JBoss Fuse is fully supported, based on the power of Apache Karaf --- Karaf allows for the easy deployment of your ActiveMQ Broker, your CXF web services, or your own Apache Camel routes.
Most of us are more familiar with the OSGI Environment, and what it offers: things like control of classloader behavior, module isolation, and APIs within a single app/JVM process.
For this post, we are gonna to setup a simple camel-route using a FIS (Fuse Integration Service) based on a Karaf image (jboss-fuse-6/fis-karaf-openshift), with which we will containerize your camel route on Karaf within OpenShift!
This example shows a simple Apache Camel microservice that exposes a REST service and logs a message in karaf.
All the necessary dependencies of this camel route are listed as features to our Karaf distribution on startup in the karaf-maven plugin:
We can override files using resources from
src/main/resources/assembly/. The included sample log file
etc/org.ops4j.pax.logging.cfg allows you to customize your logging --- in my case the log level is set to DEBUG.
This Camel route is implemented using solely the XML DSL (there is no Java code). The source code is provided in the following XML file
The endpoint of our Rest service is exposed on the port 9191, This port should be also declared & exposed in the docker by setting the http port in docker-maven-plugin:
In order to deploy this example to OpenShift, you can use one of the following application development workflows:
- Fabric8 Maven Workflow
- OpenShift Source-to-Image (S2I) Workflow
When doing local development, you can simply use fabric8 maven workflow by choosing
-Pf8-local-deploy as a goal which creates container and JSON templates. Those templates may then be applied to OpenShift with the following command:
When the example runs in OpenShift, you can use the OpenShift client tool to inspect the status:
$ oc get pods NAME READY STATUS RESTARTS AGE karaf-camel-rest-ose-k8fqw 1/1 Running 0 1h
Next, find the name of the pod that runs this example, and output the logs from the running pods with the following command:
$ oc logs karaf-camel-rest-ose-k8fqw
You can test the application by running the restful endpoint, like so:
To access the hawtio console, which is embedded by default in OpenShift Console, click the "Open java console" button (you will need to have permission to see/use this feature):
In the application console, we see the route is active:
Thanks for reading and hope that you enjoy this post!!Last updated: March 16, 2018