Search code examples
delphiglassfishopenmqsonicmq

Receiving OpenMQ messages in Delphi


I need to make a communication between Glassfish server and Delphi. I need to recieve messages from it. As i found Glassfish uses OpenMQ broker.

First, i found jms library for delphi. I found there just JMS interface. And found there SonicMQ JMS implemantation. But as i found, SonicMQ and OpenMQ - different brokers for JMS. Maybe i'm wrong.

Also i found Habari Client Libraries for OpenMQ, but this libraries are not free.

Maybe someone know any free solution for this problem? Or i'm mistaking and i can use SonicMQ implemantation?

I have downloaded Habari demo programms, but can't connect to glassfish server (Connection Closed Grasefully). Maybe i'm doing something wrong? I just need to get messages. I don't need to send them.

I have never worked with JMS before, that's why i have such questions.


Solution

  • As you wrote in your comment, the organization which runs the GlassFish server does not allow to use the platform-independent STOMP protocol to access the server.

    This means that the only way to exchange messages with the message broker is using the proprietary Java client for OpenMQ (the default JMS provider in GlassFish).

    So you would need a Java / Delphi bridge which receives the messages using the Java client, and then passes them to the Delphi side. The communication with the Delphi side could be done over TCP/IP, this would allow both synchronous and asynchronous receive of messages: either using the request/response communication style ("synchronous" communication, pulling the next message is initiated by the Delphi side) or a listener thread on the Delphi side to which the messages will "asynchronously" be pushed to from the Java side.


    A different path to communication could be over the C API. This would require importing the C client library in Delphi. The programmers guide to the c-api is available in the MQ document collection.