Try this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/html4/strict.dtd";>
<html>
<head>
        <title>Observatory</title>
    <script type="text/javascript" src="amq/amq.js"></script>
        <script type="text/javascript">
                amq.uri='amq';
                

                var myHandler = {
                        rcvMessage: function(message) {
                                alert("received " + message);
                        }
                };

                var dest = 'channel://gnip';
                //var dest = 'topic://gnip';

                function listen() {
                        amq.addListener('gnip', dest, myHandler.rcvMessage);
                }

                function sendMsg() {
                        amq.sendMessage(dest, "<message item='hello'/>");
                        alert("message sent");
                }
        </script>
</head>
<body>
<p>Observatory</p>
<p>
        <input type="button" value="Listen" onclick="listen()"/>
        <input type="button" value="Fire one" onclick="sendMsg()"/>
</p>

</body>
</html>

I added the listen code to a handler that gets called when the listen button
is pressed. I am using a modified version of amq.js, and when I ran your
code against my copy I never received a response to my listen POST request.

It appears to be some kind of timing issue. The code above works on my
setup.

-- jim
-- 
View this message in context: 
http://www.nabble.com/Looking-for-Help-ActiveMQ-and-Jetty-tf4379195s2354.html#a12535357
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to