activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pete Kay" <pete...@gmail.com>
Subject Having problem listening for Activemq message from Ajax
Date Sun, 23 Nov 2008 06:37:28 GMT
Hi,

I followed the integration doc on the jetty website and I am able to send
message from javascript to activemq, but when I fire a message to ActiveMQ,
the ajax code is not able to response to any incoming message.

>From the ActiveMQ, I can see that the message is being sent to ActiveMQ no
problem.  I also see that the addListener does cause a new consumer added,
but this new consumer gets removed right after the page is finished
loading.

It does not seem like there is any waiting or polling going on.  Does anyone
know why?  I am using Jetty 6.

Here is my code.    When this code is run, the rcvMessage function is never
called.


<head>
<title>ActiveMQ</title>
<script type="text/javascript" src="js/amq.js"></script>
<script type="text/javascript">amq.uri='/amq';</script>
<script type="text/javascript">

var myHandler =
{
  rcvMessage: function(message)
  {

     alert("received ");
  }
};
function message()
{


alert("start listen");
amq.addListener("abc","topic://test",myHandler.rcvMessage);
alert("after listen");

alert("before");
amq.sendMessage("topic://test","this is my test");
alert("after");

}



</script>
</head>

<body onload="message()">

<script type="text/javascript">


</script>

</body>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message