1. On the web.xml of your AjaxServlet make sure you have:
<context-param>
        <param-name>org.apache.activemq.brokerURL</param-name>
        <param-value>tcp://url.to.amqBroker:61616</param-value>
        <description>
                The URL of the Message Broker to connect to
        </description>
</context-param>

Now your servlet knows where the broker is.
2. On your HTML/JSP/Javascript subscribe to the topic/queue where your JMS app is publishing messages:
var myHandler =
        {
         rcvDiff: function(message)
         {
           doSomething();
         }
        };
        
        function listenersInit() {
                amq.addListener("anyID","topic://my_topic",myHandler.rcvDiff);
        }
3. You're ready to go. You don't need to embed AMQ (but you could if you want). if you want to send message or create a new topic/queue just do:
amq.sendMessage("my_queue",msg);

Regards,
Eric

Brent Baxter wrote:

So, my questions are:

1. How do I configure the AjaxServlet to find my AMQ and related topics?
2. Or, is this just "auto-magically" done for me?
3. Or, do I need to be running AMQ embedded in the same servlet container as
my web application in order for this to work?
4. Or, and is is my worst fear, is none of this possible since the AMQ
AjaxServlet simply creates topics / queues on the fly for your web app and
does not integrate at all with the full AMQ broker?

Thanks in advance.
Brent


Reply via email to