Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor Apache camel routes in a Java project using hawtio

Usually if we develop a java camel application using Java DSL then its very difficult to monitor the camel routs. To check whether the routes are running or not we need an extra monitoring application need to be developed.

But Hawtio ease our work in that. If your project is web application project then Hawtio has already camel component for it. So with out any extra efforts it will directy work.

But for Java Application it is not showing the routes.

like image 344
Amrith Raj Herle Avatar asked Oct 17 '22 22:10

Amrith Raj Herle


1 Answers

When we develop a java camel application we need some extra works to be done in order to view the routs.

Steps for configuring java related camel application on hawtio

  1. Download the hawtio from https://hawt.io/getstarted/ enter image description here

  2. Place the war file in tomcat webapps folder --> start the tomcat web server. ( If you don’t have tomcat then please download the same from https://tomcat.apache.org/download-80.cgi )

Goto: http://localhost:8080/sample-1.5.6/welcome to view the hawtio enter image description here Note: At the first time there will be no Container tab.

  1. To make use of hawtio in JVM (for java related application) we use Jolokia. Download Jolokia from https://jolokia.org/download.html

enter image description here

  1. Command to attach Jolokia on the fly (No code changes required). We can use same jar file for deployment purposes.

Use the following command line argument:

    java <location of Jolokia agent.jar file> =host=0.0.0.0 -jar <location of our jar file>

Example:

    java -javaagent:jolokia-jvm-1.4.0-agent.jar=host=0.0.0.0 -jar C:\Users\HackoMan\Documents\GitHub\target\myjar-1.0-SNAPSHOT.jar

enter image description here

  1. Goto: http://localhost:8080/sample-1.5.6/welcome hawtio --> Connect --> Discovery --> press run/play button as mentioned below.

  2. This opens a new tab. Press camel tab to view all of our route.

Then click on any route that either you want to debug or trace or to find details about it. enter image description here enter image description here

like image 162
Amrith Raj Herle Avatar answered Oct 21 '22 00:10

Amrith Raj Herle