Skip to content

fabric8-quickstarts/karaf-camel-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Karaf Camel Log QuickStart

This quickstart shows a simple Apache Camel application that logs a message to the server log every second.

This example 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-log.xml. It also shows how Karaf assembly files can be overridden using resources from src/main/resources/assembly/. The included sample log file etc/org.ops4j.pax.logging.cfg sets the log level to DEBUG.

Important
This quickstart can run in 1 mode: on Kubernetes / OpenShift Cluster. Quickstart requires Java 8 or Java 11 (fuse-karaf-openshift-jdk11-rhel8 image is used to build in Java 11)

Running the Quickstart on a single-node Kubernetes/OpenShift cluster

Important
You need to run this example on Container Development Kit 3.3 or OpenShift 3.7. Both of these products have suitable Fuse images pre-installed. If you run it in an environment where those images are not preinstalled follow the steps described in Running the Quickstart on a single-node Kubernetes/OpenShift cluster without preinstalled images.

A single-node Kubernetes/OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.

If you have a single-node Kubernetes/OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, installed and running, you can deploy your quickstart there.

To deploy this quickstart to a running single-node OpenShift cluster:

  1. Download the project and extract the archive on your local filesystem.

  2. Log in to your OpenShift cluster:

    $ oc login -u developer -p developer
  3. Create a new OpenShift project for the quickstart:

    $ oc new-project MY_PROJECT_NAME
  4. Change the directory to the folder that contains the extracted quickstart application (for example, my_openshift/karaf-camel-log) :

    $ cd my_openshift/karaf-camel-log
  5. Build and deploy the project to the OpenShift cluster:

    $ mvn clean -DskipTests oc:deploy -Popenshift
  6. List all the running pods:

    $ oc get pods
  7. Find the name of the pod that runs this quickstart. Output the logs from the running pods and see the messages sent by Camel:

    $ oc logs <name of pod>

Running the Quickstart on a single-node Kubernetes/OpenShift cluster without preinstalled images

A single-node Kubernetes/OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.

If you have a single-node Kubernetes/OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, installed and running, you can deploy your quickstart there.

  1. Log in to your OpenShift cluster:

    $ oc login -u developer -p developer
  2. Create a new OpenShift project for the quickstart:

    $ oc new-project MY_PROJECT_NAME
  3. Import base images in your newly created project (MY_PROJECT_NAME) according to documentation.

  4. Change the directory to the folder that contains the extracted quickstart application (for example, my_openshift/karaf-camel-log) :

    $ cd my_openshift/karaf-camel-log
  5. Build and deploy the project to the OpenShift cluster:

    $ mvn clean -DskipTests oc:deploy -Popenshift -Djkube.generator.from=MY_PROJECT_NAME/fuse-karaf-openshift:1.13
  6. In your browser, navigate to the MY_PROJECT_NAME project in the OpenShift console. Wait until you can see that the pod for the karaf-camel-log has started up.

  7. On the project’s Overview page, navigate to the details page deployment of the karaf-camel-log application: https://OPENSHIFT_IP_ADDR:8443/console/project/MY_PROJECT_NAME/browse/pods/karaf-camel-log-NUMBER_OF_DEPLOYMENT?tab=details.

  8. Switch to tab Logs and then see the messages sent by Camel.