You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Eric Rodriguez <to...@gmail.com> on 2008/03/03 10:34:11 UTC
Re: AjaxServlet questions
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
>
>
Re: AjaxServlet questions
Posted by Eric Rodriguez <to...@gmail.com>.
Eric Rodriguez wrote:
> function listenersInit() {
> amq.addListener("anyID","topic://my_topic",myHandler.rcvDiff);
> }
To make it clear:
"amq.addListener("anyID","topic://my_topic",myHandler.rcvDiff);"
does not need to be inside listenersInit(), that's just how I do it.