commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: commons messenger
Date Fri, 19 Apr 2002 09:54:36 GMT
Hi Thomas

----- Original Message -----
From: "Thomas Marsh" <>
> James:
> Are messagelets multithreaded?

Messagelets are Servlets so they follow exactly the same (& very successful)
multi-threaded model.

> Will messagelets be instantiated for
> processing messages

Tyically the servlet engine will instantiate a messagelet/servlet on startup
and share the same instance for each request in concurrent threads - unless
your messaglet implements SingleThreadModel in which case it will pool them.

> on a given queue as fast as the messages arrive on
> the queue?

Yes. The message is dispatched from the JMS provider into the servlet engine
(or MessageListener or MDO) in the same thread.

> Or are they processed serially? I'd like them to be processed
> as fast as they come in......

You can process messages from a single queue serially if you wish (which is
sometimes important to preserve the ordering of the messages). Or you could
process them in parallel either by

* having multiple JVMs (servlet engines) processing the messages in parallel
* having multiple threads & consumers in a JVM processing the same
destination (queue or topic)

The latter right now isn't supported terribly well. To do so we'd need to
create optional thread pools per subscription, or to asynchronously dispatch
all incoming messages to some worker thread pool to increase parallelism. I
think the latter would be a nice idea; then there's a single worker thread
pool (like in the Servlet engine itself) and all incoming messages get
dispatched into it.

This should be a fairly straightforward patch which I will get to
eventually - but by all means beat me to it, I've a few things on my plate
right now. I've added a comment (search for '####') to the code in
ManagerServlet where the actual subscription occurs where we could add some
kind of thread pooling in there.


Do You Yahoo!?
Get your free address at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message