You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by stratio <st...@hotmail.it> on 2011/04/28 10:24:01 UTC

Error with ActiveMQ 5.5 and websocket over Stomp client

Hello, I'm using a ruby client and activemq 5.5 to publish messages on a
topic and then i would like to consume them with a js client using websocket
over Stomp.

Now i'm using Jeff Mesnil js client and it worked great with Activemq 5.4,
however with the 5.5 version i'm experiencing a serious trouble. I manage to
connect but the message i get is incomplete. I only get some of the data
that compose the message itself.

Instead if i use the polling method of connection i get the complete message
without missing data (so it's not a problem of the publisher i think)

Is this a bug of the js client for stomp? Did anyone else experience
troubles like this one using activemq 5.5?

Is there a solution for this problem?

Thanks in advance for the help. Have a good day.

--
View this message in context: http://activemq.2283324.n4.nabble.com/Error-with-ActiveMQ-5-5-and-websocket-over-Stomp-client-tp3480420p3480420.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Error with ActiveMQ 5.5 and websocket over Stomp client

Posted by stratio <st...@hotmail.it>.
I just tried the 5.6 SNAPSHOT and the problem is gone :)

Thank you Timothy, have a nice day.

--
View this message in context: http://activemq.2283324.n4.nabble.com/Error-with-ActiveMQ-5-5-and-websocket-over-Stomp-client-tp3480420p3489788.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Error with ActiveMQ 5.5 and websocket over Stomp client

Posted by Timothy Bish <ta...@gmail.com>.
On Mon, 2011-05-02 at 02:04 -0700, stratio wrote:
> Hi Alex, first of all thanks for the help
> 
> I ran some other tests and I have different results depending on the data
> i'm consuming on the topic.
> 
> For example if i send a message like this :
> 
> <example1>
>      <example2>
>            Try this
>      </example2>
> </example1>
> 
> I get the result correctly.
> 
> 
> Instead if i send a message like this :
> 
> <example1>
>      <example2>
>            Don't try this at home
>      </example2>
> </example1>
> 
> I get this result :
> 
> Don't try...example2>
> 

I would recommend trying a recent SNAPSHOT build of the broker, I
beleive this issue was fixed in trunk, see:

https://issues.apache.org/jira/browse/AMQ-3284

Regards

-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/

Connect at CamelOne May 24-26

The Open Source Integration Conference


Re: Question on consumers

Posted by Don Santillan <do...@gmail.com>.
Thanks a lot Martin. This is very helpful.

With this, I'd like to verify if my understanding is correct through the 
following code snippet:

ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory(brokerURI);

Connection connection = connectionFactory.createConnection();

Destination destination = connection.createSession(isTransacted, 
acknowledgeMode).createQueue(queueName);

MessageProducer producer = connection.createSession(isTransacted, 
acknowledgeMode).createProducer(destination);

MessageConsumer consumer1 = connection.createSession(isTransacted, 
acknowledgeMode).createConsumer(destination);
consumer1.setMessageListener(new ConcreteMessageListenerImpl());
MessageConsumer consumer2 = connection.createSession(isTransacted, 
acknowledgeMode).createConsumer(destination);
consumer2.setMessageListener(new ConcreteMessageListenerImpl());
MessageConsumer consumer3 = connection.createSession(isTransacted, 
acknowledgeMode).createConsumer(destination);
consumer3.setMessageListener(new ConcreteMessageListenerImpl());
MessageConsumer consumer4 = connection.createSession(isTransacted, 
acknowledgeMode).createConsumer(destination);
consumer4.setMessageListener(new ConcreteMessageListenerImpl());
MessageConsumer consumer5 = connection.createSession(isTransacted, 
acknowledgeMode).createConsumer(destination);
consumer5.setMessageListener(new ConcreteMessageListenerImpl());

Thanks!
Don

On Tuesday, 03 May, 2011 08:13 PM, Martin C. wrote:
> Hi,
>
> the JMS threading model is based around the Session. Each Session is
> to be used by one thread. If you are using asynchronous mode (you
> register a MessageListener with the Session), every Session uses one
> thread or is to be used by one thread
> (http://download.oracle.com/javaee/1.4/api/javax/jms/Session.html). If
> you attach 5 consumers to a single session, only one of them will be
> called. You need 5 Sessions with each 1 consumer in order to feed 5
> consumers in parallel in asynchronous mode.
>
> This is not strictly speaking the truth, because in theory you may use
> a Session with more than one thread, but you need to ensure proper
> synchronization. If you are using asynchronous messaging, the
> following from http://download.oracle.com/javaee/1.4/api/javax/jms/MessageListener.html
> holds:
> <quote>Each session must insure that it passes messages serially to
> the listener. This means that a listener assigned to one or more
> consumers of the same session can assume that the onMessage method is
> not called with the next message until the session has completed the
> last call.</quote>
>
> So if you want to go parallel, you need to create more Sessions and
> MessageConsumers.
>
> Best regards,
> Martin
>
> On Mon, May 2, 2011 at 11:50 AM, Don Santillan<do...@gmail.com>  wrote:
>> Hello,
>>
>> I have a basic question about message consumers that I really need to
>> confirm that my understanding is correct.
>>
>> Do message consumers run in different threads?
>>
>> Suppose I have 5 consumers assigned to a queue. Are these consumers
>> independent with each other and are running in different threads?
>>
>> Thanks!
>>

Re: Question on consumers

Posted by "Martin C." <ma...@gmx.at>.
Hi,

the JMS threading model is based around the Session. Each Session is
to be used by one thread. If you are using asynchronous mode (you
register a MessageListener with the Session), every Session uses one
thread or is to be used by one thread
(http://download.oracle.com/javaee/1.4/api/javax/jms/Session.html). If
you attach 5 consumers to a single session, only one of them will be
called. You need 5 Sessions with each 1 consumer in order to feed 5
consumers in parallel in asynchronous mode.

This is not strictly speaking the truth, because in theory you may use
a Session with more than one thread, but you need to ensure proper
synchronization. If you are using asynchronous messaging, the
following from http://download.oracle.com/javaee/1.4/api/javax/jms/MessageListener.html
holds:
<quote>Each session must insure that it passes messages serially to
the listener. This means that a listener assigned to one or more
consumers of the same session can assume that the onMessage method is
not called with the next message until the session has completed the
last call.</quote>

So if you want to go parallel, you need to create more Sessions and
MessageConsumers.

Best regards,
Martin

On Mon, May 2, 2011 at 11:50 AM, Don Santillan <do...@gmail.com> wrote:
> Hello,
>
> I have a basic question about message consumers that I really need to
> confirm that my understanding is correct.
>
> Do message consumers run in different threads?
>
> Suppose I have 5 consumers assigned to a queue. Are these consumers
> independent with each other and are running in different threads?
>
> Thanks!
>

Re: Question on consumers

Posted by Don Santillan <do...@gmail.com>.
bump

On Monday, 02 May, 2011 05:50 PM, Don Santillan wrote:
> Hello,
>
> I have a basic question about message consumers that I really need to 
> confirm that my understanding is correct.
>
> Do message consumers run in different threads?
>
> Suppose I have 5 consumers assigned to a queue. Are these consumers 
> independent with each other and are running in different threads?
>
> Thanks!

Question on consumers

Posted by Don Santillan <do...@gmail.com>.
Hello,

I have a basic question about message consumers that I really need to 
confirm that my understanding is correct.

Do message consumers run in different threads?

Suppose I have 5 consumers assigned to a queue. Are these consumers 
independent with each other and are running in different threads?

Thanks!

Re: Error with ActiveMQ 5.5 and websocket over Stomp client

Posted by stratio <st...@hotmail.it>.
Hi Alex, first of all thanks for the help

I ran some other tests and I have different results depending on the data
i'm consuming on the topic.

For example if i send a message like this :

<example1>
     <example2>
           Try this
     </example2>
</example1>

I get the result correctly.


Instead if i send a message like this :

<example1>
     <example2>
           Don't try this at home
     </example2>
</example1>

I get this result :

Don't try...example2>



I really can't understand why the three dots appear instead of the rest of
the message.

It seems like the data is too long and it gets cut after 10 characters
replaced by the three dots.

Why does it happen?


Thanks again for the help

--
View this message in context: http://activemq.2283324.n4.nabble.com/Error-with-ActiveMQ-5-5-and-websocket-over-Stomp-client-tp3480420p3489598.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Error with ActiveMQ 5.5 and websocket over Stomp client

Posted by Alex Dean <al...@crackpot.org>.
On Apr 28, 2011, at 3:24 AM, stratio wrote:

> Hello, I'm using a ruby client and activemq 5.5 to publish messages on a
> topic and then i would like to consume them with a js client using websocket
> over Stomp.

I believe you've had problems in the past consuming XML messages which contain embedded HTML.  Is that the case here as well?  If so, perhaps try publishing messages which don't contain HTML and see if that makes any difference.

Sorry I can't provide any more detailed questions.  I'm not too familiar with the websocket code, though I keep meaning to make time to learn how it works.

A quick JIRA search turned up this issue, which sounds like it might be related: https://issues.apache.org/jira/browse/AMQ-3284

alex