This tutorial takes you through some of the basic steps of integrating Delphi applications and JBoss AS 6 with the help of Habari Client for HornetQ. This is an updated version of the tutorial of May 2010, tested with the final release, “JBoss AS 6.0.0.Final”.
To complete this tutorial, you need the software and resources listeds in the following list.
- JDK 6 (download)
- JBoss 6.0.0.Final (download)
- Habari Client for HornetQ – ProducerTool and ConsumerTool (download)
- Add the JBOSS_HOME environment variable which points to the JBoss installation folder.
- Open the file $JBOSS_HOME/server/default/deploy/hornetq/hornetq-configuration.xml
- To enable the Stomp acceptor, add the following code in the acceptors section of the file:
<acceptors> ... <acceptor name="stomp"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="protocol" value="stomp"/> <param key="port" value="61613"/> </acceptor> ... </acceptors>
- Open the file $JBOSS_HOME/server/default/deploy/hornetq/hornetq-jms.xml
- Add a new queue with the name “TOOL.DEFAULT” (this is the default queue name used by the Habari ProducerTool and ConsumerTool):
<configuration> ... <queue name="TOOL.DEFAULT"> <entry name="/queue/TOOL.DEFAULT"/> </queue> ... </configuration>
Note: you can also create new queues and topics in the configuration file while the server is running, JBoss will automatically reload the file and apply the changes.
You can now start JBoss AS 6:
or (on Windows)
With netstat /a you can verify if the Stomp acceptor is running on port 61613.
Running the Delphi Test
- start ProducerTool application to send messages
- start the ConsumerTool application to receive the messages
Verify the Message Queue Size
Navigate to the JBoss administration web app at http://localhost:8080 and go to the JMS Queue section. The statistics now should show 10 messages received and sent.