[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-users
Subject:    addListener doesn't receive messages
From:       kvbisme <kerry.v.barnes () saic ! com>
Date:       2009-06-26 16:26:33
Message-ID: 24223350.post () talk ! nabble ! com
[Download RAW message or body]


So I am trying to set up a sample showing ActiveMQ's messaging capabilities. 
In particular when I saw the Ajax listener I got excited because this is
exactly what I needed.  

Anyway I set up a VERY simple example using the samples on the WIKI and I am
having issues.  What am I possibly missing?

I have a simple HTML page that accepts a text and then sends it to ActiveMQ
and I have a listener waiting to alert me when it comes in.  

I have ActiveMQ embedded in my test, and looking at the JMX Console I see
the listener getting registered and I see the message(s) getting loaded into
my topic.  The wiring doesn't look like it should be difficult, but for some
reason I get no message :,(

This doesn't look like it should be so difficult … can anyone give me some
advise?

I am using Tomcat 5.5.27 for my environment and Java 1.6.0_14.

web.xml:
...
<context-param>
	<param-name>org.apache.activemq.brokerURL</param-name>
	<param-value>vm://localhost</param-value>
</context-param>
<context-param>
      <param-name>org.apache.activemq.embeddedBroker</param-name>
      <param-value>true</param-value>
</context-param>

<servlet>
	<servlet-name>AjaxServlet</servlet-name>
	<servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
	<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
	<servlet-name>AjaxServlet</servlet-name>
	<url-pattern>/amq/*</url-pattern>
</servlet-mapping>
...

Javascript:

...
var ActiveMQHandler =
{
  receive: function(msg)
  {
	alert("Receiving Message: " + msg);
	var mr = new MessageRecord({time:new Date().toString(),msg:msg});
	incommingMessages.insert(0,mr);
  }
};

amq.addListener("88", 'topic://test.route', ActiveMQHandler.receive);

...

handler: function(button, event) {
    var m = sendTab.findById("messageToSend").getValue()
    amq.sendMessage("topic://test.route", m);
        				
    var mr = new MessageRecord({time:new Date().toString(),msg:m});
}

...

HTML:
...
<script type="text/javascript" src="amq/amq.js"></script>
<script type="text/javascript">amq.uri='/amqtest/amq';</script>
...



-- 
View this message in context: \
http://www.nabble.com/addListener-doesn%27t-receive-messages-tp24223350p24223350.html \
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic