LibraryLink ToToggle FramesPrintFeedback

Stomp Example

FUSE Message Broker provides some sample code in fuse-message-broker-Version/example/ruby that enables you to experiment with the Stomp protocol in the Ruby programming language.

If you want to find out more about writing Stomp clients in other scripting languages, see the Cross Language Client Development Guide.

You must download and install the requisite packages to support the Ruby programming language before you can run the Stomp example. Install the following packages:

To try out the Stomp protocol, perform the following steps:

Check that the the Stomp connector is present in the default broker configuration file (in fuse-message-broker-Version/conf/activemq.xml), as follows:

<beans>
    ...
    <transportConnectors>
       ...
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
    </transportConnectors>
    ...
</beans>

Run the default broker by entering the following at a command line:

activemq

The default broker automatically takes its configuration from the default configuration file.

[Note]Note

The activemq script automatically sets the ACTIVEMQ_HOME and ACTIVEMQ_BASE environment variables to FUSEInstallDir/fuse-message-broker-Version by default. If you want the activemq script to pick up its configuration from a non-default conf directory, you can set ACTIVEMQ_BASE explicitly in your environment. The configuration files will then be taken from $ACTIVEMQ_BASE/conf.

To connect the listener tool to the stomp://localhost:61613 endpoint (Stomp over TCP), change directory to fuse-message-broker-Version/example/ruby and enter the following command:

ruby listener.rb

They Ruby listener connects to the endpoint, stomp://localhost:61613, by default. You could change this endpoint address by editing the listener.rb script.

To connect the publisher tool to the stomp://localhost:61613 endpoint (Stomp over TCP), change directory to fuse-message-broker-Version/example/ruby and enter the following command:

ruby publisher.rb

You should see some output like the following:

Sent 1000 messages
Sent 2000 messages
Sent 3000 messages
Sent 4000 messages
Sent 5000 messages
Sent 6000 messages
Sent 7000 messages
Sent 8000 messages
Sent 9000 messages
Sent 10000 messages
Received report: Received 10000 in 4.567 seconds, remaining: 9