activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: receiveNoWait problem
Date Fri, 18 Aug 2006 10:08:58 GMT
On 8/18/06, peter anderson <peter.anderson@egsgroup.com> wrote:
> James Strachan <james.strachan@...> writes:
>
> >
> >
> > Does the instantiation of the consumer servlet create the consumer?
> > Once a consumer is created messages are dispatched asynchronously to
> > it; so if you create a consumer then immediately call receiveNoWait()
> > then its typically gonna return null.
> >
> > > Even if I leave a number of minutes between these events the messages
> > > are still not being found. However running them in a debugger does work
> > > which suggest receiveNoWait() is failing.
> >
> > Maybe its the debugger adds enough time between the createConsumer()
> > call and the receiveNoWait()
> >
> > > p.s. are there any admin tools I could use to look at messages
> > > in the queue ?
> >
> > Yes...
> > http://activemq.org/site/how-can-i-monitor-activemq.html
>
> James
>
> Yes it does. I put in a 1 second delay and it now works fine.

FWIW receive(1000) is better than a sleep as receive(timeout) will
return as soon as a message arrives.


> At the moment I am running ActiveMQ from within Tomcat is this the
> best thing to do ?

Sure

> If not how would I access ActiveMQ from my servlets ?

BTW you might find the activemq-web-demo a useful example of working
with ActiveMQ from a web application and HTTP or Ajax.


> p.s. in the application I would have 100s of destinations - would this
> create a perfomance problem ?

No. Try to reuse the same producer. For consumers you should try
create them on startup and not create one consumer for each servlet
request if you can help it - or create a consumer for the duration of
a Http Session

-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message