The Habari ActiveMQ Client library for Delphi and Free Pascal can be used for monitoring of Java(tm) applications which use the popular Apache Log4j logging framework.
This screenshot shows the output of a Delphi console application. It listens to a logging topic which receives log messages from an ActiveMQ message broker. The log messages have been sent to the logging topic using the Log4J JMSAppender.

How does it work?
- the Java(tm) application uses the Apache Log4j framework to send log events to a JMS topic on a Apache ActiveMQ message broker
- these log events are native Java objects so they can be consumed by other Java clients which suscribe to the message topic
- the Delphi client subscribes to the ActiveMQ broker topic and indicates that it wants to receive the log events serialized, using JSON or XML
- ActiveMQ performs the object serialization when it sends the object message to the Delphi client – Java clients which have a subscription for the same log topic are unaffected
- the Delphi client then deserializes and prints the messages
It is possible to use serialization in the opposite direction: a log event object can be created in Delphi code and then sent to the message broker. ActiveMQ will then convert them to native Java log events. A Java application then can create a consumer for the log topic and receive the log events from Delphi.
Update: the HabariActiveMQObjectExchange download now includes the Java and Delphi source code for the Log4j logging message publisher and subscriber examples.
Discover more from Habarisoft Blog
Subscribe to get the latest posts sent to your email.