Contact the core Jetty developers at
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ...
scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Skip to end of metadata
Go to start of metadata
Integrating with ActiveMQ
For using ActiveMQ queues and topics with Jetty, you have two choices:
- Traditional server-side jms api calls
ActiveMQ with Ajax and Jetty
Here's an example of sending a message to a queue:
Here's an example of setting up to receive messages from a queue. All you need do is to add a listener with a unique id, the name of the queue or topic from which you want to receive messages, and the name of a function which will be called back when a message is available.
Here's the plumbing you need to take advantage of this very convenient feature:
- Include these lines in your html:
- Include thse lines in your
web.xml, changing the url of the broker as appropriate for your installation:
<description>The URL of the Message Broker to connect to</description>
<description>Whether we should include an embedded broker or not</description>
- Include the
activemq-web.jar and all of its dependencies in your webapp, or alternatively, copy them to the $JETTY-HOME/lib/ext directory if you want them to be available for all of your webapps. Here's a maven2 dependency clause that you might find useful:
You will also need to make sure that jcl104-over-slf4j-1.0.1.jar and an slf4j log implementation jar are available at runtime, as ActiveMQ uses commons logging. You can move these jars out of $JETTY-HOME/lib/jsp-2.0 and into $JETTY-HOME/lib to make them generally available on the classpath.
This ActiveMQ Ajax mechanism is based on Jetty's Continuations mechanism and thus in fact works most efficiently when deployed on Jetty, however the same webapp will also run unaltered on other containers.
There is more information on available on ActiveMQ in general and the Ajax mechanism in particular.