# JBoss Messaging Bridge Example

$Revision: 82920 $

## Overview

This example deploys a message bridge in JBoss AS, which is configured to move messages from one destination to another.
The example then sends some message to the source destination, then consumes the same messages from the target destionation, demonstrating that the bridge has successfully moved the messages from the source to the target.
The example is somewhat artificial in that normally a bridge would be used to move messages from source and target destinations on different servers, but it serves to illustrate how to use a bridge.
This example relies on having access to a running JBoss default instance, which is available when you have installed JBoss AS 5.

## Running the example

1. Set up the JBOSS_HOME environment variable to point to the JBoss AS 5 installation. For example, /home/user/jboss-5.0.0.GA then your JBOSS_HOME value should be /home/user/jboss-5.0.0.GA
2. Go to the example's home directory
cd .../examples/bridge
3. Run the example:
ant
The output of a successful run should be similar to:

[tim@Vigor14 bridge]$ ant Buildfile: build.xml identify: [echo] ########################################################################### [echo] # Running the BRIDGE example # [echo] ########################################################################### [echo] The queue: ${example.queue.name} [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar sanity-check: init: [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes compile: [javac] Compiling 5 source files to /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes [javac] Compiling 1 source file to /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes> deploy: [copy] Copying 1 file to /home/tim/dev/jboss-5.0.0.GA/server/messaging/deploy sleep: [echo] Sleeping for 5 seconds ... run: [java] Queue JBossQueue[A] exists [java] Queue JBossQueue[B] exists [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was successfully sent to the A queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The message was received successfully from the B queue [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4) [java] ##################### [java] ### SUCCESS! ### [java] ##################### undeploy: [delete] Deleting: /home/tim/dev/jboss-5.0.0.GA/server/messaging/deploy/test-bridge-service.xml BUILD SUCCESSFUL Total time: 9 seconds

## Troublesooting

### 1. I get "javax.jms.JMSSecurityException: User null is NOT authenticated"

You probably didn't install JBoss Messaging correctly. A fresh JBoss Messaging installation requires changes in the security configuration of a default JBoss instance, specifically a properly configured "messaging" security domain. Follow the instructions from the "Installation" paragraph of the release documentation.