It is relatively straightforward to try out the various OpenWire+transport combinations using the sample code provided. After configuring the broker to add the relevant transport connectors, you can use the sample producer tool and the consumer tool to transmit messages through the broker using the following protocols: OpenWire over TCP or OpenWire over HTTP.
![]() | Note |
|---|---|
The secure socket protocols—OpenWire over SSL, and OpenWire over HTTPS—are discussed in the FUSE Message Broker Security Guide. |
Before you can build and run the sample clients, you must have installed the Apache Ant build tool, version 1.6 or later (see http://ant.apache.org/).
The OpenWire examples depend on the sample producer and consumer clients located in the following directory:
FUSEInstallDir/fuse-message-broker-Version/example
For a detailed description of the example clients, see [REVISIT - Xref to Getting Started, or whatever.]]
To try out the OpenWire protocol, perform the following steps:
Add the following transport connectors to the default broker configuration file
(in fuse-message-broker-Version/conf/activemq.xml):
<beans>
...
<transportConnectors>
...
<transportConnector name="openwire" uri="tcp://localhost:61616"/>
<transportConnector name="http" uri="http://localhost:61620"/> </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 |
|---|---|
The |
To connect the consumer tool to the tcp://localhost:61616 endpoint (OpenWire over TCP), change
directory to fuse-message-broker-Version/example and enter the following command:
ant consumer -Durl=tcp://localhost:61616 -Dmax=100
You should see some output like the following:
Buildfile: build.xml
init:
compile:
consumer:
[echo] Running consumer against server at $url = tcp://localhost:61616
for subject $subject = TEST.FOO
[java] Connecting to URL: tcp://localhost:61616
[java] Consuming queue: TEST.FOO
[java] Using a non-durable subscription
[java] We are about to wait until we consume: 100 message(s) then
we will shutdown
To connect the producer tool to the tcp://localhost:61616 endpoint (OpenWire over TCP), open a new
command prompt, change directory to fuse-message-broker-Version/example and enter the following command:
ant producer -Durl=tcp://localhost:61616
In the window where the consumer tool is running, you should see some output like the following:
[java] Received: Message: 0 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 1 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 2 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 3 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 4 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 5 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 6 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 7 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 8 sent at: Wed Sep 19 14:38:06 BST
2007 ...
[java] Received: Message: 9 sent at: Wed Sep 19 14:38:06 BST
2007 ...
To connect the producer tool to the http://localhost:61620 endpoint (OpenWire over HTTP), enter the
following command from the example directory:
ant producer -Durl=http://localhost:61620
This command sends ten new messages to the consumer client.
![]() | Note |
|---|---|
The JAR files for the HTTP protocol are currently located in the |