Habari STOMP Client 10.3 is not final yet, but it is approaching its first release candidate for ActiveMQ, Artemis, OpenMQ and RabbitMQ. Its main theme is IMessageListener: asynchronous receive is now a supported feature, with documented limits, in both the classic and the simplified API.

IMessageListener is now a supported feature

Until now, listener-based receive sat behind a define named HABARI_BROKEN_MESSAGELISTENER, and the name was an honest warning. In 10.3 we did the groundwork to make it dependable:

  • One delivery path in all four transports. The listener code is built and tested in both toolchains (Delphi and Free Pascal), and the subscription check is always on.
  • A clear error where listeners are unsupported. On Synapse and mORMot2, you now get an explicit error instead of silence.
  • Synchronous Receive is unaffected. With the define on, Receive now behaves exactly as it does with the define off.
  • Thread-safe consumer and session lists. Consumers can be created and closed while messages are being delivered. We added a dedicated test that fails within milliseconds if the locking is removed. The gate-on suite passes against all four brokers.
  • MessageListener on IMQConsumer. The simplified API now has listeners too, so you don’t need to drop down to the classic interface.

The supported limits are one session, no receipts, and the Indy adapter only. Only the HABARI_BROKEN_MESSAGELISTENER define is deprecated. We are not renaming it, because the name still warns about open defects and we don’t want you to change your build options twice.

Simplified API: IMQContext gets more capable

IMQContext now implements IMaxLineLength and IFailoverProtocol and forwards both to its connection. You can set a maximum line length and configure failover without leaving the simplified API. The Doxygen comments recommend using a bounded MaxLineLength.

Fixes

  • Artemis listeners now receive messages.
  • Received messages carry the transaction id on all brokers.
  • Forwarded messages no longer send the old subscription header.
  • The receive-thread lock is now freed only after the thread has actually ended.
  • The receive thread is now named “Habari receive thread”, which makes debugging easier. Along the way we removed a busy-wait at the end of Execute and some unused options.

Known limitation: OpenMQ and transacted acknowledgement

OpenMQ never acknowledges a message received in a transacted session, with or without the transaction header. We verified this by checking queue depth with imqcmd, and 10.2 behaves the same, so this is a broker limitation rather than a regression. Artemis does apply the acknowledgement and ignores only its transaction header. If you use OpenMQ, avoid receiving in a transacted session.

Source layout change

BTThread.pas and BTStompReadThreadIndy.pas moved from source/optional to source in all four products. The ant package staging step places them under source/ as well. If your project references these units through a source/optional search path, you can drop that path.

Deprecations

We are announcing the following removals so you have time to prepare:

  • HABARI_X_MAXLINELENGTH and HABARI_ENABLE_FAILOVER_PROTOCOL will be removed in the next release.
  • HABARI_BROKEN_MESSAGELISTENER will be removed in a later release. The next release is planned to ship more of the listener work, with the define still required.

Demos

  • HabariChatRooms (demo/delphichat-listener) is a new demo that runs several chat rooms on one IMQContext, each with its own listener. It is included in the demo zip as HabariChatRooms.exe.
  • Existing demos got a round of fixes. Load balancing now acknowledges only on success and saves binary data safely. The reconnect demo acknowledges after processing. The RPC demo has a client deadline and a clean Ctrl+C stop on the server. The text-message demo no longer waits forever. The tutorials and several demos now use IMQContext. The throughput demo no longer touches Windows APIs outside MSWINDOWS. We also removed seven stale .cfg files and renamed the RabbitMQ ReveiveLogsDirect demo.

Under the hood

We also did some internal refactoring. TBTSession became TBTAbstractSession, with the shared members lifted into it. Consumers, producers, browsers and topic subscribers no longer depend on the broker-specific BTConnection.pas, which keeps an ENoMessageTransformer alias, so existing code is unaffected. There are no public API changes. We also added Artemis tests for flow control (consumer window size and prefetch size).


Habari STOMP Client Libraries

Native STOMP client libraries that connect Delphi and Free Pascal applications to open source message brokers. They let Object Pascal code use message queue technology, which is distributed, loosely coupled, reliable and asynchronous. You can build integrated systems with the peer-to-peer (queue) and publish-subscribe (topic) models.

Four versions are available, each specialized for one broker: Apache ActiveMQ, Apache ActiveMQ Artemis, Eclipse OpenMQ and RabbitMQ. All share a common high-level API built on connections, sessions or contexts, destinations, message producers and message consumers.

  • Broker extensions: message expiration, priority, persistent messages, durable subscriptions, temporary queues, message selectors and queue browsing, with a feature matrix showing what each broker supports.
  • Client-side features: failover protocol, connection builder, transacted send, and message conversion with example JSON and XML bindings.
  • Flexible dependencies: works with Internet Direct (Indy), Ararat Synapse or mORMot 2 for TCP/IP, with optional SLF4P logging.
  • Tested: ships with DUnit and FPCUnit tests, a Getting Started guide, tutorials and examples.

Typical uses: load balancing and distributed processing, client notification in multi-tiered applications, remote configuration and control, alerting and logging, and integration with ISAPI, PHP, .NET, Python or Java web applications. The libraries speak the STOMP wire format only (AMQP and MQTT are not supported).