Habari Client Libraries

Habari® Client Libraries provide access to enterprise quality solutions for distributed messaging.

Download Feature Matrix »

Use it with ActiveMQ

Download Demo »

Currently v3.0


ActiveMQ logo

Use it with HornetQ

Download Demo »

Currently v1.6

HornetQ logo

Use it with OpenMQ

Download Demo »

Currently v2.0


OpenMQ logo

Use it with RabbitMQ

Download Demo »

Currently v1.1


RabbitMQ logo

Habari Client libraries provide access to standards-based, enterprise quality solutions for distributed messaging.

Delphi applications now can take advantage of open source message broker technology, which is

  • Distributed
  • Loosely coupled
  • Reliable
  • Asynchronous

and build integrated systems, connecting clients using the peer-to-peer or the publish and subscribe communication model.

They support the open source JMS message brokers ActiveMQ, HornetQ and OpenMQ, and the open source AMQP message broker RabbitMQ. Available for Embarcadero Delphi 2009 to XE2 (32 and 64 Bit + Mac OS X) and Free Pascal.

Inter-Process Communication Reliable, Asynchronous Messaging

Transfer documents to other applications - Submit point-to-point messages even if the receiver currently is not running.

Broadcast notifications - send messages to all running applications, for example a configuration command. Using the publish / subscribe communication model, news can be delivered to all registered client applications. The message sender works like a broadcast station, and does not care if clients don't listen.

Cross-language / cross platform information exchange - using cross-language clients, Java, Delphi and C# applications can be connected (see message broker documentation for details).

Object exchange - exchange maps and objects, using XML or JSON serialization.

ipc

Messaging enables high-speed, asynchronous, program to program communication with reliable delivery.

Gregor Hohpe, Bobby Woolf et al - Enterprise Integration Patterns

Load Balancing and Distributed Processing

load balancing

Server-side: Using the point-to-point or queuing model, many 'worker' applications can be installed on different computers.

Every new message sent to the message queue will be delivered only to one client.

The message broker will keep messages until they are expired or delivered to a client.

Client-side: The "failover transport" is an easy to use load-balancing mechanism.

Every new connection to one of the available brokers will choose a new broker address in a round-robin or random way.

The Flickr engineering team is obsessed with making pages load as quickly as possible. To that end, we're refactoring large amounts of our code to do only the essential work up front, and rely on our queueing system to do the rest.

Myles Grant - http://code.flickr.com/blog/2008/09/26/flickr-engineers-do-it-offline/

Web Applications Asynchronous request execution

Habari Client Libraries allow communication of Delphi applications with Java™ web apps running on Apache Tomcat and Jetty, and with open source Java EE (Enterprise Edition) systems, such as IBM® WebSphere CE®, Apache Geronimo, GlassFish™ and JBoss AS, including bidirectional exchange with web applications (JavaServer Faces, Servlets) and Enterprise JavaBeans, and of course with PHP applications.

Web application integration examples are available with full Java source code for Apache Tomcat 6 and 7, GlassFish v3, and JBoss AS 6 - including an example for communication with a Google Web Toolkit (GWT) application.

web

web

Habari Client Libraries closely follow the Java Message Service API. The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients.(1)

The "Java(tm) Message Service Tutorial" gives an introduction to the basic building blocks of a JMS application and the programming model.


(1) Wikipedia, Java Message Service, http://en.wikipedia.org/wiki/Java_Message_Service (as of Apr. 4, 2010, 13:00 GMT)."

Habari Client Library Core Classes and Interfaces

Class Interface Description
TBTJMSConnectionFactory IConnectionFactory A ConnectionFactory is used for creating Connections.
TBTJMSConnection IConnection A Connection object is a client's active connection to its JMS provider.
TBTJMSSession ISession A Session object is a single-threaded context for producing and consuming messages.
TBTMessageProducer IMessageProducer A client uses a MessageProducer object to send messages to a destination.
TBTMessageConsumer IMessageConsumer A client uses a MessageConsumer object to receive messages from a destination.
TBTMessage IMessage This object represents a JMS message.
TBTDestination IDestination This object represents a destination.

A minimum of three units is required for a Habari Client project. They provide the core API declarations, the broker-specific connection factory, and the TCP/IP adapter.

  // use required units
  uses
    BTJMSInterfaces,
    BTConnectionFactory,
    BTCommAdapterIndy,
    ...

Interface-type variables for the connection factory, connection, session and destination use the API types.

Note: this also makes code highly portable between Habari libraries for different message brokers.

    // declare API objects
    var
      Factory: IConnectionFactory;
      Connection: IConnection;
      Session: ISession;
      Queue: IQueue;
      Producer: IMessageProducer;
      Msg: IMessage;
    ...

The Session interface plays an important role as it provides the API functions for creation of destinations, producers, consumers and messages. Starting the connection also starts the session. Transactional sessions also automatically start a new transaction.

    // create a connection factory with default settings
    Factory := TBTJMSConnectionFactory.Create;
    // create a connection, a non-transactional session, and a queue
    Connection := Factory.CreateConnection;
    Session := Connection.CreateSession(False, amAutoAcknowledge);
    Queue := Session.CreateQueue('TEST.QUEUE');
    // start the connection
    Connection.Start;
    ...

A client uses a MessageProducer object to send messages to a destination.

    // create a message producer
    Producer := Session.CreateProducer(Queue);
    // create a text message
    Msg := Session.CreateTextMessage('Hello world!');
    // send the message
    Producer.Send(Msg);
    ...

Finally, close the connection.

Note: there is no need to close the sessions, producers, and consumers of a closed connection.

    // close the connection
    Connection.Close;
    ...

Basic

Core elements of the Habari Client Library API.

Feature Example Description
Message types Msg := Session.CreateTextMessage('Hello World!'); Supported message types: TextMessage, BytesMessage, ObjectMessage, MapMessage
Destination types Queue := Session.CreateQueue(TestQueue);
Topic := Session.CreateTopic(TestTopic);
Queues and Topics provide message exchange using the peer-to-peer or the publish and subscribe communication model.
Expiration MessageProducer.Send(JMSMessage, dmNonPersistent, DEFAULT_PRIORITY, TIMETOLIVE); Message expiration can be used to limit the time to live of a message.
Priority MessageProducer.Send(JMSMessage, dmNonPersistent, DEFAULT_PRIORITY, TIMETOLIVE); Messages can use priority headers.
Properties Msg.SetStringProperty('nickname', 'jane'); Messages can carry properties for meta data. With most message brokers, message consumers can define filters to receive only messages with matching properties. (check featue matrix for supported brokers)

Advanced

High-level features of Habari Client Libraries for JMS message brokers.

Feature Example Description
Persistent messages MessageProducer.Send(JMSMessage, dmPersistent, DEFAULT_PRIORITY, TIMETOLIVE); Persistent Messages survive a broker restart.
Transacted Sessions Session.Rollback; Transacted sessions can use Commit and Rollback.
Durable topics Consumer := Session.CreateDurableSubscriber(Topic, SubName); If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable subscriber.
New Failover and load balancing URL := 'stomp://primary,stomp://secondary'; Select the server in a random or round-robin order, and connect to the next if a connection can not be established.
JMS Selector Consumer := Session.CreateConsumer(Destination, 'color = ''red'''); Filter messages by header properties.
NoLocal flag MessageConsumer := Session.CreateConsumer(Destination, '', True); Do not receive broadcast messages sent from the same connection.
Object Serialization Msg := Session.CreateObjectMessage(MyObject); Support for NativeXml and OmniXML.

Other

Supported compilers and third-party libraries.

Feature Description
Compiler Support Delphi 2009, 2010, XE and XE2
Free Pascal 2.4.4
Non-Unicode versions (Delphi 6 to 2007): available, please contact us
Supported TCP/IP Libraries Internet Direct (Indy) 10.5.8
Synapse rev.144
Logging Library Define HABARI_LOGGING to compile with Log4D support.
100% Delphi No external libraries (DLL), compiles into the executable.
Object Exchange Object transformation wrappers based on JSON (SuperObject) and XML (NativeXml and OmniXML).
Source Code Full source code, including unit tests (ActiveMQ 5.3.2, 5.4.2, 5.5.0, OpenMQ 4.4u1, 4.4u2, 4.5, 4.5.1 and 4.6 (build 3-c), HornetQ 2.2.5.Final).
Updates Free updates for one year included.

Accor Services

Hamburg Airport / Airport Business Information Systems GmbH

Airport Business Information Systems GmbH Unternehmensgruppe Hamburg Airport

Animolecular Ltd

APD Communications

Atos Worldline

Banco Privado de Inversiones Argentina

Better Office GmbH

Burrows Communications Ltd

C3 Solutions

Carana Ltd

Heidi Computers Ltd

Informatica Systems Ltd

OXXO S.A

Peer Software, Inc.

Plexo, Inc.

Raytheon

Sabre Travelocity

Samuel Sekuritas Indonesia

Shanghai Wind Information Co. Ltd

Spiral SVS

Thum+Mahr GmbH

Transrail Sweden AB

Trondent Development Corp.

Veltec Ltda.