One outstanding feature of the popular Apache ActiveMQ message broker is its rich message conversioncapability, which allows cross-platform/cross-language exchange by serialization of JMS object and map messages to XML or JSON. Non-Java clients do not have to support the native ActiveMQ wire protocol. Instead, they can use a simple protocol such as STOMP.
An article by Thomas Beyer (also available in German language) gives a short introduction into popular messaging solutions which are available as free open source projects.
“Newer architectures and the standardized AMQP protocol have led to a flood of message brokers. All brokers take claim to be fast, robust and reliable. But what really distinguish the broker? How do I choose the right broker? Should we continue to use established brokers such as the ActiveMQ or try a more modern one? This article attempts to answer these questions and help the reader in selecting a suitable broker.”
To configure ActiveMQ to use the statistics plugin add the following to the ActiveMQ XML configuration:
The statistics plugin looks for messages sent to particular destinations.
Query running broker statistics
To query the running statistics of the message broker, the client sends an empty message to a Destination named ActiveMQ.Statistics.Broker, and sets the replyto field with the Destination you want to receive the result on. The statistics plugin will send a MapMessage filled with the statistics for the running ActiveMQ broker.
Requires ActiveMQ 5.3 or higher
To configure ActiveMQ to use the statistics plugin, add the following to the ActiveMQ XML configuration:
If no destination is specified, the program returns the broker statistics
You can also use wildcards too, and receive a separate message for every destination matched.
BTJMSInterfaces, BTJMSConnection, BTSessionIntf, BTSerialIntf,
Destination, ReplyQueue: IQueue;
Connection := TBTJMSConnection.MakeConnection;
// Create and assign the message transformer
Session := Connection.CreateSession(False, amAutoAcknowledge);
// listen on reply queue
ReplyQueue := Session.CreateQueue('Habari' + '?' +
BTStompTypes.SH_TRANSFORMATION + '=' + TRANSFORMER_ID_MAP_XML);
Consumer := Session.CreateConsumer(ReplyQueue);
// create the pseudo destination
if ParamCount = 0 then
Destination := Session.CreateQueue('ActiveMQ.Statistics.Broker');
Destination := Session.CreateQueue('ActiveMQ.Statistics.Destination.' + ParamStr(1));
// display destination name
WriteLn('Request statistics for ' + Destination.QueueName + ' ...');
// create the message and set reply queue name
JMSMessage := Session.CreateTextMessage;
JMSMessage.JMSReplyTo := ReplyQueue;
Producer := Session.CreateProducer(Destination);
// read the result message
Reply := Consumer.Receive(1000) as IMapMessage;
// list the map key/values
while Assigned(Reply) do
MapNames := Reply.GetMapNames;
for I := 0 to Length(MapNames) - 1 do
Key := MapNames[I];
WriteLn(Key + '=' + Reply.GetString(Key));
Reply := Consumer.Receive(1000) as IMapMessage;
WriteLn('No more message on queue ' + ReplyQueue.QueueName);
on E: Exception do
WriteLn('Press any key');
If you are a Delphi or Free Pascal developer and interested in application integration withWebSphere MQ, please let me know. You can vote for it or drop me a message. Currently, Habari Client libraries are only available for open source message brokers (ActiveMQ, Apollo, HornetQ, Open MQ and RabbitMQ) – which also have commercial support options. A Delphi / Free Pascal application integration with WebSphere MQ could be a useful option for enterprise developers.
With this library, Delphi and Free Pascal developers can build integrated solutions, connecting applications using the peer-to-peer and the publish and subscribe communication model.
New in version 1.2
All client libraries include the full source code, one year free minor and major updates, royalty-free distribution of applications, many demo projects, unit tests, API documentation in HTML format, and a “Getting Started” PDF.
About Habari Client libraries
Habari Client libraries provide access to standards-based, enterprise quality solutions for distributed messaging. With these libraries, Delphi applications now can take advantage of open source message broker technology which is distributed, loosely coupled, reliable and asynchronous – and build integrated systems, connecting clients using the peer-to-peer or the publish and subscribe communication model.
<path to ActiveMQ>\bin\activemq-admin.bat start xbean:activemq-demo.xml
VisualMMWebDemo.exe uses an embedded Indy HTTP server. The local firewall will issue a warning if you start it. When started, the demo will launch the web browser to show the monitor charts (see http://www.habarisoft.com/visualmm.html for a dynamic example).
The demo writes its own memory allocation statistics to the ActiveMQ broker and reads it back to create the charts.
The next demo will also allow to select from a list of running applications which provide VisualMM data.
The next release of Habari Client for ActiveMQ includes a web demo application which displays memory allocation charts for running Delphi applications. This demo leverages a feature of FastMM (the new memory manager in Delphi): run time memory allocation statistics.
A dynamic chart example is available. It displays four charts:
FastMM Memory Block Count (current snapshot)
FastMM Overall Block Count (timeline for last n snapshots)
FastMM Memory Block Size (current snapshot)
FastMM Overall Block Size (timeline for last n snapshots)
You must be logged in to post a comment.