HornetQ Message Broker and Delphi: Management Notification API

HornetQ, an open source project from the JBoss Community, includes support for the Stomp protocol in the development version.

A useful feature of HornetQ are management notifcations. HornetQ servers emit management notifications when events of interest occur (consumers are created or closed, destinations are created or deleted, security authentication fails, etc.). These notifications can be received either by using JMX or by receiving JMS Messages from a well-known destination.

In the broker configuration file hornetq-configuration.xml, a JMS topic name can be set for the management name:

  jms.topic.notificationsTopic </management-notification-address>

The Delphi code below creates a connection and subscribes to the topic. Next, it uses a loop to receive the notification messages:

Connection := TBTJMSConnection.MakeConnection;
Session := Connection.CreateSession(False, amAutoAcknowledge);
Destination := Session.CreateTopic('notificationsTopic');
Consumer := Session.CreateConsumer(Destination);

while True do
  Reply := Consumer.Receive;
  PropNames := Reply.GetPropertyNames;
  for I := 0 to Length(PropNames) - 1 do
    PropName := PropNames[I];
    WriteLn(Format('  %s: %s',
      [PropName, Reply.GetStringProperty(PropName)]));


Output example:

JBoss HornetQ management notifications example

The Habari Client for HornetQ library for Delphi (6 – XE) and Free Pascal is now in development at habarisoft.com.

Related articles

Getting Started with the HornetQ Messaging System (Javalobby)


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s