Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

How to containerize your Camel route on Karaf within OpenShift

December 21, 2016
Abdellatif Bouchama
Related topics:
ContainersJavaKubernetesMicroservices
Related products:
Red Hat FuseRed Hat OpenShift Container Platform

    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!

    To get started, your Maven Archetype catalog includes some examples, but let's see my example available here: karaf-camel-rest-ose.

    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:

    No video provider was found to handle the given URL. See the documentation for more information.

    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 src/main/resources/OSGI-INF/blueprint/camel-rest.xml:

    No video provider was found to handle the given URL. See the documentation for more information.

    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:

     
    No video provider was found to handle the given URL. See the documentation for more information.
    and the service is configured in the pom.xml for the fabric8 plugin:
     

    https://gist.github.com/abouchama/e601bb40e094894ab813150f3fde8273

    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:

    mvn -Pf8-local-deploy

    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:

    http://karaf-camel-rest-ose.rhel-cdk.10.1.2.2.xip.io/FIS/Awesome

    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: June 30, 2023

    Recent Posts

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    What’s up next?

     

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.