This example shows how to configure a ConnectionFactory to send messages using the HTTP protocol. The example will use such a ConnectionFactory to create two JMS connections: the first one to send a message to the queue and the second one to read the message from the queue. In both cases, the message will be sent over an HTTP connection. The example is considered successful if the client receives without any error the message that was previously sent to the queue.
This example needs to have access to a running JBoss default instance. However, the example will automatically deploy its own queue, unless a queue with the same name is already deployed.
$ ant Buildfile: build.xml identify: [echo] ############################################################################ [echo] # Running the HTTP example # [echo] ############################################################################ [echo] The queue: testQueue [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar sanity-check: init: [mkdir] Created dir: C:\java\messaging\docs\examples\http\output\classes [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes compile: [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes [javac] Compiling 1 source file to C:\java\messaging\docs\examples\http\output\classes deploy: [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy sleep: [echo] Sleeping for 10 seconds ... run: [java] Queue /queue/testQueue exists [java] The message was successfully sent to the testQueue queue [java] Received message: Hello! [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4) [java] [java] ##################### [java] ### SUCCESS! ### [java] ##################### undeploy: [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\messaging-http-service.xml BUILD SUCCESSFUL Total time: 14 seconds |