You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by colincrist <co...@hermesjms.com> on 2010/02/04 12:33:29 UTC
Session.setMessageListener not working in 5.3.2
See attached unit test. The receiveOneMessageUsingSessionListener() test
hangs.
Tests all work okay with, for example, Tibco EMS.
http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
PublicTestMessageExchange.java
Regards,
Colin.
--
View this message in context: http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451302.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Session.setMessageListener not working in 5.3.2
Posted by Rob Davies <ra...@gmail.com>.
will have a look ...
On 4 Feb 2010, at 12:00, colincrist wrote:
>
>
> I meant version 5.3.0
>
>
> colincrist wrote:
>>
>> See attached unit test. The receiveOneMessageUsingSessionListener()
>> test
>> hangs.
>>
>> Tests all work okay with, for example, Tibco EMS.
>>
>> http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
>> PublicTestMessageExchange.java
>>
>> Regards,
>>
>> Colin.
>>
>
> --
> View this message in context: http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451613.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/
Re: Session.setMessageListener not working in 5.3.2
Posted by colincrist <co...@hermesjms.com>.
I meant version 5.3.0
colincrist wrote:
>
> See attached unit test. The receiveOneMessageUsingSessionListener() test
> hangs.
>
> Tests all work okay with, for example, Tibco EMS.
>
> http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
> PublicTestMessageExchange.java
>
> Regards,
>
> Colin.
>
--
View this message in context: http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451613.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Session.setMessageListener not working in 5.3.2
Posted by Gary Tully <ga...@gmail.com>.
You can configure the destination prefetch on the broker configuration via a
DestinationPolicy rather than on the destination in JNDI. Or on the
connection factory. See:
http://activemq.apache.org/what-is-the-prefetch-limit-for.html
Prefetch 0 is useful for a polling consumer, a message is dispatched on
request. With a listener there needs to be some preemptive dispatching,
hence a prefetch > 0.
Dispatching to a new consumer in activemq is by default asynchronous. For
that reason, for synchronous consumers we would recommend looping a timed
receive while null is returned.
while ((msg = receive(timeout)) == null) { // do something else for a bit}
Using dispatchAsync=false is an alternative option for ensuring that
available messages are immediately dispatched to a new synchronous consumer.
But in essence, that root cause is not a bug, it is by design. hope this
helps.
On 8 February 2010 09:58, colincrist <co...@hermesjms.com> wrote:
>
>
>
> Hi Gary,
>
> Thanks for the workaround but this only works with synchronous consumers -
> when I use the same topic (obtained from JNDI in reality - unlike the code
> I
> shared) with an async consumer I get:
>
> javax.jms.JMSException: Illegal prefetch size of zero. This setting is not
> supported for asynchronous consumers please set a value of at least 1
> at
>
> org.apache.activemq.ActiveMQMessageConsumer.setMessageListener(ActiveMQMessageConsumer.java:377)
>
> This means I would need to have different topics in JNDI for different
> styles of consumer. Ugly.
>
> The root cause is clearly a bug that needs fixing - is there a way to raise
> it somewhere?
>
> Colin.
>
>
>
>
> Gary Tully wrote:
> >
> > with prefetch=0 it should work ok as this will force a receive() to poke
> > the
> > broker rather than depending on async delivery.
> >
> > change:
> >
> > queue = session.createQueue("TEST");
> >
> > to
> >
> > queue = session.createQueue("TEST?consumer.prefetchSize=0");
> >
> >
> > On 4 February 2010 11:33, colincrist <co...@hermesjms.com> wrote:
> >
> >>
> >> See attached unit test. The receiveOneMessageUsingSessionListener() test
> >> hangs.
> >>
> >> Tests all work okay with, for example, Tibco EMS.
> >>
> >> http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
> >> PublicTestMessageExchange.java
> >>
> >> Regards,
> >>
> >> Colin.
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451302.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > http://blog.garytully.com
> >
> > Open Source Integration
> > http://fusesource.com
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27497580.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
--
http://blog.garytully.com
Open Source Integration
http://fusesource.com
Re: Session.setMessageListener not working in 5.3.2
Posted by colincrist <co...@hermesjms.com>.
Hi Gary,
Thanks for the workaround but this only works with synchronous consumers -
when I use the same topic (obtained from JNDI in reality - unlike the code I
shared) with an async consumer I get:
javax.jms.JMSException: Illegal prefetch size of zero. This setting is not
supported for asynchronous consumers please set a value of at least 1
at
org.apache.activemq.ActiveMQMessageConsumer.setMessageListener(ActiveMQMessageConsumer.java:377)
This means I would need to have different topics in JNDI for different
styles of consumer. Ugly.
The root cause is clearly a bug that needs fixing - is there a way to raise
it somewhere?
Colin.
Gary Tully wrote:
>
> with prefetch=0 it should work ok as this will force a receive() to poke
> the
> broker rather than depending on async delivery.
>
> change:
>
> queue = session.createQueue("TEST");
>
> to
>
> queue = session.createQueue("TEST?consumer.prefetchSize=0");
>
>
> On 4 February 2010 11:33, colincrist <co...@hermesjms.com> wrote:
>
>>
>> See attached unit test. The receiveOneMessageUsingSessionListener() test
>> hangs.
>>
>> Tests all work okay with, for example, Tibco EMS.
>>
>> http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
>> PublicTestMessageExchange.java
>>
>> Regards,
>>
>> Colin.
>> --
>> View this message in context:
>> http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451302.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> http://blog.garytully.com
>
> Open Source Integration
> http://fusesource.com
>
>
--
View this message in context: http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27497580.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Session.setMessageListener not working in 5.3.2
Posted by Gary Tully <ga...@gmail.com>.
with prefetch=0 it should work ok as this will force a receive() to poke the
broker rather than depending on async delivery.
change:
queue = session.createQueue("TEST");
to
queue = session.createQueue("TEST?consumer.prefetchSize=0");
On 4 February 2010 11:33, colincrist <co...@hermesjms.com> wrote:
>
> See attached unit test. The receiveOneMessageUsingSessionListener() test
> hangs.
>
> Tests all work okay with, for example, Tibco EMS.
>
> http://old.nabble.com/file/p27451302/PublicTestMessageExchange.java
> PublicTestMessageExchange.java
>
> Regards,
>
> Colin.
> --
> View this message in context:
> http://old.nabble.com/Session.setMessageListener-not-working-in-5.3.2-tp27451302p27451302.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
--
http://blog.garytully.com
Open Source Integration
http://fusesource.com