activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <christian.po...@gmail.com>
Subject Re: Java, Stomp, & Web Sockets
Date Tue, 21 May 2013 21:25:08 GMT
Interesting, I haven't come across trying to do websockets from Java. I'm
guessing your messaging infrastructure won't open up a regular tcp-based
STOMP connector?

I don't think you'll find a Stomp over websockets implementation for Java
out of the box... but I don't think it would be too bad to create it one.
The beauty of STOMP is that it's a simple protocol. You could probably
start with the websockets client from jetty (or google for another java
websockets lib) and then maybe use the codec from the stompjms project.

Or maybe others can chime in with some other suggestions...





On Tue, May 21, 2013 at 1:52 PM, Hereen Oh <hereen@stormpath.com> wrote:

> Hi Christian,
>
> Thanks for responding.
>
> Unfortunately the server side messaging infrastructure to which we are
> trying to connect only exposes Web Sockets that utilize the Stomp protocol.
>
> How can my Java client use the JMS API to communicate with that server side
> infrastructure?
>
> Thanks,
> -h
>
>
> On Tue, May 21, 2013 at 4:22 PM, Christian Posta
> <christian.posta@gmail.com>wrote:
>
> > 1) you don't want to use ws:// for the client side within java.. that
> > transport's not implemented because it's intended for use in a WebSocket
> > enabled environment, ie, a browser. Just use the tcp://localhost:X where
> X
> > is the transportConnector configured to handle STOMP connections.
> >
> > 2) Use the StompJms code from fusesource. It's a more mature now, follows
> > the JMS API, and should be good to use.
> >
> > So basically, juse StompJms from the Java side, use a websockets/stomp
> > library from the browser.
> >
> > Good luck, let us know how it goes.
> >
> >
> >
> > On Tue, May 21, 2013 at 12:43 PM, Hereen Oh <hereen@stormpath.com>
> wrote:
> >
> > > Hi,
> > >
> > > We are interested in using ActiveMQ's (v5.8.0) Web Socket transport
> with
> > > Java.
> > >
> > > We have been successful in bringing up a broker and running the
> included
> > > javascript web socket demo. However, we're running into some
> > > difficulty/confusion with how to proceed with Java.
> > >
> > > 1) Web socket connection
> > > We were able to create a Java client that can listen and send messages
> > to a
> > > broker using the tcp transport.
> > > <amq:connectionFactory id="connectionFactory"
> > > brokerURL="tcp://localhost:616
> > > 16"/>
> > >
> > > However, when we switch to using the ws transport by changing the URL
> > like
> > > so:
> > > <amq:connectionFactory id="connectionFactory"
> > > brokerURL="ws://localhost:61614"  />
> > >
> > > We get an error thrown from the TransportFactory class (line 158):
> "Could
> > > not create Transport. Reason: java.io.IOException: createTransport()
> > method
> > > not implemented!"
> > >
> > > Are we missing some additional changes in our configuration?
> > >
> > > 2) Stomp
> > > There is seemingly clear documentation on how to use Stomp with
> scripting
> > > languages but we're not sure what we should be doing for Java. The
> > ActiveMQ
> > > documentation (http://activemq.apache.org/stomp.html) mentions a
> > provided
> > > Stomp Java API but cautions users:
> > > "Note that this API is provided purely for testing purposes and you
> > should
> > > always consider using standard JMS API from Java instead of this one."
> > > Are we to look for some sort of bridging component between jms and
> stomp
> > > (like stompjms (https://github.com/fusesource/stompjms) or stompj (
> > > http://code.google.com/p/stompj/)?
> > >
> > > What is the recommended solution for using Java with ActiveMQ's web
> > > sockets?
> > >
> > > Any info would be appreciated.
> > > Thanks,
> > > -h
> > >
> > >
> > >
> > > --
> > > @goStormpath
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>
>
>
> --
> @goStormpath
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

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