Consume ActiveMQ JMS MapMessages from Delphi

One outstanding feature of the popular Apache ActiveMQ message broker is its rich message conversion capability, 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.

Continue reading

Apache ActiveMQ 5.12.0 released

Apache ActiveMQ 5.12.0 resolves several issues, and provides significant improves to the AMQP and MQTT support in the broker as well as fixing issues with STOMP and MQTT over WebSockets plus much much more.

Source: http://activemq.apache.org/activemq-5120-release.html

Continue reading

ActiveMQ, Qpid, HornetQ and RabbitMQ in Comparison

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.”

Article URL: http://predic8.com/activemq-hornetq-rabbitmq-apollo-qpid-comparison.htm

Apache ActiveMQ 5.10.0 released

Apache ActiveMQ 5.10.0 resolves more than 234 issues, mostly bug fixes and improvements. It has the following new features:

  • Java 8 support
  • Apache Shiro Security Plugin – http://activemq.apache.org/shiro.html
  • Hardened MQTT support
  • Hardened AMQP support
  • Hardened LevelDB store
  • Improved RAR/JCA adapter
  • Improved Runtime configuration plugin
  • Improved Web console

Source: http://activemq.apache.org/activemq-5100-release.html

A Delphi and Free Pascal STOMP based client library is available from Habarisoft.

Habari Client Libraries

 

Query ActiveMQ Broker Statistics with Delphi

Broker Configuration

To configure ActiveMQ to use the statistics plugin add the following to the ActiveMQ XML configuration:

<plugins>
  <statisticsBrokerPlugin/>
</plugins>

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.

Source code

program DestStatistics;

(**
  Requires ActiveMQ 5.3 or higher
  To configure ActiveMQ to use the statistics plugin, add the following to the ActiveMQ XML configuration:
  <broker>
  ...
    <plugins>
      <statisticsBrokerPlugin/>
    </plugins>
  ...
  </broker>

  Usage:
  ------
  DestStatistics [destination]
  If no destination is specified, the program returns the broker statistics

  Reference
  ---------
  http://activemq.apache.org/statisticsplugin.html
  https://issues.apache.org/activemq/browse/AMQ-2379
  http://rajdavies.blogspot.com/2009/10/query-statistics-for-apache-activemq.html

  You can also use wildcards too, and receive a separate message for every destination matched.
*)

{$APPTYPE CONSOLE}

uses
  SysUtils,
  BTCommAdapterIndy, BTMessageTransformerXMLMapOmni,
  BTJMSInterfaces, BTJMSConnection, BTSessionIntf, BTSerialIntf,
  BTStompTypes, BTTypes,
  Classes;

var
  Connection: IConnection;
  Session: ISession;
  Producer: IMessageProducer;
  Consumer: IMessageConsumer;
  Destination, ReplyQueue: IQueue;
  JMSMessage: ITextMessage;
  Reply: IMapMessage;
  MapNames: PMStrings;
  I: Integer;
  Key: string;

begin
  Connection := TBTJMSConnection.MakeConnection;
  try
    try
      // Create and assign the message transformer
      SetTransformer(Connection, TBTMessageTransformerXMLMapOmni.Create(nil));

      Connection.Start;
      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
      begin
        Destination := Session.CreateQueue('ActiveMQ.Statistics.Broker');
      end
      else
      begin
        Destination := Session.CreateQueue('ActiveMQ.Statistics.Destination.' + ParamStr(1));
      end;

      // 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);
      Producer.Send(JMSMessage);

      // read the result message
      Reply := Consumer.Receive(1000) as IMapMessage;

      // list the map key/values
      while Assigned(Reply) do
      begin
        MapNames := Reply.GetMapNames;
        for I := 0 to Length(MapNames) - 1 do
        begin
          Key := MapNames[I];
          WriteLn(Key + '=' + Reply.GetString(Key));
        end;
        WriteLn;
        Reply := Consumer.Receive(1000) as IMapMessage;
      end;

      WriteLn('No more message on queue ' + ReplyQueue.QueueName);

      Connection.Stop;

    except
      on E: Exception do
        WriteLn(E.Message);
    end;
  finally
    Connection.Close;
  end;

  WriteLn('Press any key');
  ReadLn;
end.

 


Query Statistics for Apache ActiveMQ with Delphi

Apache ActiveMQ 5.9.1 released

Apache ActiveMQ 5.9.1 resolves more than 120 issues, mostly bug fixes and improvements. It has the following new features:

  • Replicated LevelDB Store for shared nothing Master/Slave.
  • Runtime Configuration
  • Hawtio web console
  • Generic JMS XA connection pool in activemq-jms-pool module (has no ActiveMQ dependency)
  • MQTT over WebSockets support
  • broker Apache Camel component
  • Broker auto-restart upon losing master status
  • AMQP Hardening
  • LevelDB Hardening

Source: http://activemq.apache.org/activemq-591-release.html

A Delphi and Free Pascal client library is available from Habarisoft.

 

ActiveMQ Apollo 1.7 open source message broker released

The Apache ActiveMQ Project announced the availability of Apollo 1.7, a new open source message broker.

ActiveMQ Apollo is a faster, more reliable, easier to maintain messaging broker built from the foundations of the original ActiveMQ. It accomplishes this using a radically different threading and message dispatching architecture. Like ActiveMQ, Apollo is a multi-protocol broker and supports STOMP, AMQP, MQTT, Openwire, SSL, and WebSockets.

 

Client libraries are available for many programming languages. Habarisoft offers client libraries for Delphi and Free Pascal.

Habari Client for Apollo

Java EE 7 reference implementation GlassFish 4 released

GlassFish 4 – the first Java EE 7 application server – has been released. It is open source and available for download here – in two versions (Full Java EE platform and the Java EE Web Profile with reduced resource footprint) for Windows, Solaris, Linux and OS X.

New features include standardized API support for the WebSocket (JSR 356) and JSON (JSR 353) specifications, HTML5 support in the JavaServer Faces version 2.2, JMS 2.0, a Batch processing API (JSR 352), Concurrency support, and more. See also: GlassFish 4 Brings Java EE 7

Delphi and Free Pascal applications can be integrated in GlassFish (Full Java EE platform) web applications and web services using the Habari Client libraries from Habarisoft, which provide direct communication with the Open Message Queue (Open MQ) message broker, which is the default JMS provider in GlassFish 3 and 4.

Habari Client for OpenMQ