activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JG <gibb...@discoverbeyond.com>
Subject JMS to Websocket using camel routes question
Date Thu, 27 Jun 2013 15:26:50 GMT
Hi,

I've been trying to create a camel route from a JMS queue to a websocket
queue using activemq, but I've hit a wall, and I'm not sure where to go from
here given the examples in activemq or online.  It seems I have all the
components working, but I just can't connect them.

I'm using ActiveMQ 5.8.0, Camel 2.10.4, running on OSX 10.8.4 with (Apple)
Java 1.6.0_51, and stomp.js

Here's what I've done so far:

Added to activemq.xml
       ...
        <transportConnectors>
            ...
            <transportConnector name="websocket" uri="ws://0.0.0.0:61614"/>
        </transportConnectors>
        ...
        <import resource="camel.xml"/>
        ...

Added route to camel.xml
        ...
        <route>
            <from uri="activemq:queue:fooQ"/>
            <to uri="activemq:queue:fooA"/>
            <to uri="websocket://foo?sendToAll=true"/>
            //
            
        </route>
        ...

Downloaded camel (2.10.4) and copied *camel-websocket-2.10.4.jar* to
*lib/camel*

Started activemq like so: *./activemq camel*

No errors reported and the route started:  console output
<http://pastebin.com/kSmfdGvP>  

I publish data to the queue fooQ from java and I do receive the data in my
consuming app listening to fooA, but the html5 page using stomp.js never
receives the data.

Here's what I have in the html 5 page:

            <script type="text/javascript">

            var url = "ws://localhost:61614/stomp";
            var client = Stomp.client(url);

            var connect_callback = function() {
                alert('connected');

                var onmessage = function(message) {
                    alert('msg received: ' + message.body);
                    // called every time the client receives a message
                }
                client.subscribe("foo", onmessage);

            };

            client.connect('guest', 'guest', connect_callback);

I've been searching online for similar examples but really haven't found any
that helped.  Any help would be really appreciated.

Also, I can send ws messages from the included chat.js demo to my html5 and
it's received without an issue.  It's just the JMS to WS that's not working.

-Jeremy





--
View this message in context: http://activemq.2283324.n4.nabble.com/JMS-to-Websocket-using-camel-routes-question-tp4668650.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message