You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Johan Kindgren <jo...@acrend.se> on 2009/04/05 09:40:21 UTC

Stomp client for java, seems to hang?

I've sent this question to the users-list previously but with no response.

I've done a quick test where I tried to publish JMS queues via
StompConnect (http://stomp.codehaus.org/StompConnect) and then use
ActiveMQ as a JMS implementation for handling the published
queues.Unfortunately this didn't work at all, and from spending a day
in debug-mode and stepping through the Stomp implementation it seems
that there are something missing. Maybe my setup is all wrong, but my
short question is if anyone has tried to use ActiveMQ as a java client
against StompConnect?

The following setup was used:
Server side:
Create an instance of StompConnect and inject the ConnectionFactory of
a JBoss server (Jboss Messaging).

At the client side:
1. Create an instance of ActiveMQConnectionFactory and set the url to
"stomp://localhost:61613".
2. Create an instance of ActiveMQQueue and set the queue-name.
3. Since we are using Spring, create a JmsTemplate and try to send a message.

The ConnectionFactory seems to find the right implementation and
creates a ActiveMQConnection and sets the transport layer to use the
stomp package. The first thing that the ActiveMQConnection does is to
send a ConnectionInfo command, but the stomp transport implementation
decides that this command shouldn't be sent. Now comes the tricky
part, the layer above (ResponseCorrelator) expects a response and
simply hangs.

Since I'm new to ActiveMQ I'm really not sure if it's possible to use
the JMS-api in the above describe way. My questions are:
1. Should I be able to use the Jms api as a wrapper against the stomp protocol?
2. Has anyone used the Stomp-client implementation?

Tried both ActiveMQ 5.2.0 and 5.1.0, seems to be no changes in the
Stomp-implementation.

I've created a testcase that shows the problem, see attached file. My
test hangs in the setup, while creating a Jms session, so I'm not sure
that the actual test will really work if it would get past the
session-problem.

/Johan

Re: Stomp client for java, seems to hang?

Posted by Johan Kindgren <jo...@acrend.se>.
Thanks for your help! Our problem was that we used two different
versions of JBoss AS, and the remoting library is incompatible between
them. We thought that stomp could help out, by using a common protocol
wrapped in the jms api. Too bad that didn't work out...

/Johan


2009/4/6 Dejan Bosanac <de...@nighttale.net>:
> Hi Johan,
>
> ActiveMQ shouldn't be used "as a Java client against Stomp". JMS and Stomp
> are two distinct protocols. If you want to send messages from your Java
> clients (to ActiveMQ or JBoss) use appropriate JMS API. Stomp is usually
> used to do messaging in scripting languages (such as Ruby e.g.). ActiveMQ
> supports Stomp directly, so you can send/receive messages directly from your
> scripts. StompConnect is used to provide the same funcionality for other
> brokers, such as JBoss for example. Finally, ActiveMQ provides Stomp Java
> API (http://activemq.apache.org/stomp.html#Stomp-JavaAPI), but it is
> different from JMS API (and it is primaraly used for testing).
>
> Hope this helps.
>
> Cheers
> --
> Dejan Bosanac
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Sun, Apr 5, 2009 at 9:40 AM, Johan Kindgren <jo...@acrend.se>wrote:
>
>> I've sent this question to the users-list previously but with no response.
>>
>> I've done a quick test where I tried to publish JMS queues via
>> StompConnect (http://stomp.codehaus.org/StompConnect) and then use
>> ActiveMQ as a JMS implementation for handling the published
>> queues.Unfortunately this didn't work at all, and from spending a day
>> in debug-mode and stepping through the Stomp implementation it seems
>> that there are something missing. Maybe my setup is all wrong, but my
>> short question is if anyone has tried to use ActiveMQ as a java client
>> against StompConnect?
>>
>> The following setup was used:
>> Server side:
>> Create an instance of StompConnect and inject the ConnectionFactory of
>> a JBoss server (Jboss Messaging).
>>
>> At the client side:
>> 1. Create an instance of ActiveMQConnectionFactory and set the url to
>> "stomp://localhost:61613".
>> 2. Create an instance of ActiveMQQueue and set the queue-name.
>> 3. Since we are using Spring, create a JmsTemplate and try to send a
>> message.
>>
>> The ConnectionFactory seems to find the right implementation and
>> creates a ActiveMQConnection and sets the transport layer to use the
>> stomp package. The first thing that the ActiveMQConnection does is to
>> send a ConnectionInfo command, but the stomp transport implementation
>> decides that this command shouldn't be sent. Now comes the tricky
>> part, the layer above (ResponseCorrelator) expects a response and
>> simply hangs.
>>
>> Since I'm new to ActiveMQ I'm really not sure if it's possible to use
>> the JMS-api in the above describe way. My questions are:
>> 1. Should I be able to use the Jms api as a wrapper against the stomp
>> protocol?
>> 2. Has anyone used the Stomp-client implementation?
>>
>> Tried both ActiveMQ 5.2.0 and 5.1.0, seems to be no changes in the
>> Stomp-implementation.
>>
>> I've created a testcase that shows the problem, see attached file. My
>> test hangs in the setup, while creating a Jms session, so I'm not sure
>> that the actual test will really work if it would get past the
>> session-problem.
>>
>> /Johan
>>
>



-- 
____________________________
Johan Kindgren
Acrend AB
Phone: +46 (0) 733-58 36 60
E-mail: johan.kindgren@acrend.se
www.acrend.se

Re: Stomp client for java, seems to hang?

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Johan,

ActiveMQ shouldn't be used "as a Java client against Stomp". JMS and Stomp
are two distinct protocols. If you want to send messages from your Java
clients (to ActiveMQ or JBoss) use appropriate JMS API. Stomp is usually
used to do messaging in scripting languages (such as Ruby e.g.). ActiveMQ
supports Stomp directly, so you can send/receive messages directly from your
scripts. StompConnect is used to provide the same funcionality for other
brokers, such as JBoss for example. Finally, ActiveMQ provides Stomp Java
API (http://activemq.apache.org/stomp.html#Stomp-JavaAPI), but it is
different from JMS API (and it is primaraly used for testing).

Hope this helps.

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Sun, Apr 5, 2009 at 9:40 AM, Johan Kindgren <jo...@acrend.se>wrote:

> I've sent this question to the users-list previously but with no response.
>
> I've done a quick test where I tried to publish JMS queues via
> StompConnect (http://stomp.codehaus.org/StompConnect) and then use
> ActiveMQ as a JMS implementation for handling the published
> queues.Unfortunately this didn't work at all, and from spending a day
> in debug-mode and stepping through the Stomp implementation it seems
> that there are something missing. Maybe my setup is all wrong, but my
> short question is if anyone has tried to use ActiveMQ as a java client
> against StompConnect?
>
> The following setup was used:
> Server side:
> Create an instance of StompConnect and inject the ConnectionFactory of
> a JBoss server (Jboss Messaging).
>
> At the client side:
> 1. Create an instance of ActiveMQConnectionFactory and set the url to
> "stomp://localhost:61613".
> 2. Create an instance of ActiveMQQueue and set the queue-name.
> 3. Since we are using Spring, create a JmsTemplate and try to send a
> message.
>
> The ConnectionFactory seems to find the right implementation and
> creates a ActiveMQConnection and sets the transport layer to use the
> stomp package. The first thing that the ActiveMQConnection does is to
> send a ConnectionInfo command, but the stomp transport implementation
> decides that this command shouldn't be sent. Now comes the tricky
> part, the layer above (ResponseCorrelator) expects a response and
> simply hangs.
>
> Since I'm new to ActiveMQ I'm really not sure if it's possible to use
> the JMS-api in the above describe way. My questions are:
> 1. Should I be able to use the Jms api as a wrapper against the stomp
> protocol?
> 2. Has anyone used the Stomp-client implementation?
>
> Tried both ActiveMQ 5.2.0 and 5.1.0, seems to be no changes in the
> Stomp-implementation.
>
> I've created a testcase that shows the problem, see attached file. My
> test hangs in the setup, while creating a Jms session, so I'm not sure
> that the actual test will really work if it would get past the
> session-problem.
>
> /Johan
>