activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <>
Subject Re: what is best practices to implement Multithread + JMS ?
Date Fri, 18 Sep 2009 21:55:36 GMT
On Fri, Sep 18, 2009 at 1:11 PM, czy11421 <> wrote:
> what is best practices to implement Multithread + JMS ?
> Let us assume we are listening financial market data feed. I have this
> coding like this:
> class MyClass implements Listener{
>  private final ExecutorService pool =
> Executors.newFixedThreadPool(poolSize);
>  onMessage(...){
>    pool.execute(new Handler(Message));       }
>  class Handler implements Runnable {
>    public run(){
>      // get data, same it into db
>    }
>  }
> }
> Anybody can share your experiences in this topic ?

When building JMS consumers, I recommend the use of the Spring

The DMLC provides the ability to set a TaskExecutor, a range of
concurrent consumers, various tiered caching levels (connection,
session, consumer), it works with transactions and much more. The
reason I recommend the DMLC (or one of the other message listener
containers) is because writing JMS clients is a lot of work and the
Spring message listener containers dramatically reduce the complexity
thereby saving you quite a lot of time. Given the tremendous
flexibility, the robustness, the high amount of configurability and
the widespread deployment in businesses all over the world (including
in the financial markets), there really no reason not to use it.

Together with the Spring CachingConnectionFactory
these tools will speed your JMS development client developer markedly.

perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"

ActiveMQ in Action:

View raw message