Hi,

You have an extra "}" after the _feed function

I also did the following in case the above doesn't fix it:

change your script includes to:
<script type="text/javascript" src="amq/prototype.js"></script>
<script type="text/javascript" src="amq/behaviour.js"></script>
<script type="text/javascript" src="amq/_amq.js"></script>

- or just -

<script type="text/javascript" src="amq/amq.js"></script>

These jars are served from activemq-web.jar so you don't have to copy all the js files

If it still doesn't work, please also send your web.xml.

Regards,
Patrick



Interition wrote:
I am trying to familiarise myself with
org.apache.activemq.web.MessageListenerServlet to publish and subscribe to
ActiveMQ topics.

The servlet is working and logging so I can monitor it.  I have a simple
publisher that appears to be able to post to a specified topic but my simple
subscriber just never seems to receive anything. Help appreciated big time. Snippets below...

MessagePublisher.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
    <head>
        <title>Message Publishing</title>
        <script type="text/javascript" src="js/prototype.js"></script>
        <script type="text/javascript" src="js/behaviour.js"></script>
        <script type="text/javascript" src="js/_amq.js"></script>
        <script type="text/javascript">amq.uri='amq';</script>
        <script type="text/javascript">
                function publishMessage() {
                  amq.sendMessage("topic://MY.TEST","<data><item>Hello
World</item></data>");
                 }
        </script>
    </head>
    <body>
        <form action="#">
            <input type="button" value="Publish Message"
onclick="publishMessage();"/>
        </form>
    </body>
</html>


MessageListener.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
    <head>
        <title>MessageListener Test</title>
        <script type="text/javascript" src="js/prototype.js"></script>
        <script type="text/javascript" src="js/behaviour.js"></script>
        <script type="text/javascript" src="js/_amq.js"></script>
        <script type="text/javascript">amq.uri='amq';</script>
        <script type="text/javascript">
var feedHandler = { _feed: function(message) {
                        alert("received: " +message);
                        document.getElementById("result").innerHTML =
message;
                    }
                  }
                };

                function chartPoll(first)
                {
                   if (first)
                   {
amq.addListener('charts','topic://MY.TEST',feedHandler._feed);
                   }
                }

                amq.addPollHandler(chartPoll);
        </script>
    </head>
    <body>
        <h1>Message Listener</h1>
        <hr/>
        <div id="result"></div>
    </body>
</html>
--
View this message in context: http://www.nabble.com/AJAX-t1829608.html#a4991458
Sent from the ActiveMQ - User forum at Nabble.com.


Reply via email to