Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!193.252.117.184.MISMATCH!feeder.news.orange.fr!not-for-mail Date: Thu, 17 Nov 2011 08:41:24 +0100 From: jlp User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: JMS scalability question References: <5f805cc6-58b1-49e5-933f-4c6dbbceb65d@g7g2000vbd.googlegroups.com> <5890740.1493.1321468227592.JavaMail.geo-discussion-forums@prap37> <27800224.227.1321492704158.JavaMail.geo-discussion-forums@prdy11> <780efba5-4448-48ee-87f6-530cd16c55fd@m10g2000vbc.googlegroups.com> In-Reply-To: <780efba5-4448-48ee-87f6-530cd16c55fd@m10g2000vbc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Lines: 54 Message-ID: <4ec4baa1$0$2512$ba4acef3@reader.news.orange.fr> Organization: les newsgroups par Orange NNTP-Posting-Date: 17 Nov 2011 08:41:21 CET NNTP-Posting-Host: 90.45.83.221 X-Trace: 1321515681 reader.news.orange.fr 2512 90.45.83.221:4266 X-Complaints-To: abuse@orange.fr Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9994 [OT] There is an implementation of Actor Pattern ( Scala and Java ) => http://akka.io/docs/akka/1.3-RC1/Akka.pdf Le 17/11/2011 07:59, saxo123@gmx.de a écrit : > Hi Lew, > >> This is why I asked about your use case. Not all use cases call for queues, otherwise every single program would always use them. No? > > it's about developing a little actor framework (see > http://en.wikipedia.org/wiki/Actor_model) with distributed actors > connected through some means to exchange messages through the wire. > Actors are active objects, e.g. objects that run in their own thread > (to prevent deadlock and other locking issues). The usual approach to > implement this is something like this: > > public class MyActor implements Runnable { > > BlockingQueue queue = new LinkedBlockingQueue(); > > public static void main(String[] args) { > new Thread(new MyActor()).start(); > } > > public void run() { > while(true) { > Message message = queue.take(); > if(message.getSelector().equals("doWork")) { > doWork(); > return; > } > } > } > > public void doWork() { > System.out.println("doing my work"); > } > > } > > So messages are exchanged between actors through queues when an actor > wants to notify another actor about something. With distributed actors > those messages would have to be exchanged through the wire. Since > these messages are similar to command objects that are added to queues > my first approach to move this into a distributed setting was to use > distributed queues like JMS queues. Each actor type serves a different > purpose with all the actors working in a collaborative fashion. > >> You aren't specific, given that you've only mentioned the solutions you've examined and not the purpose they should serve, but the shape of your search (assuming your analysis of what you need is correct) does indicate that your use case might be appropriate for queues. > > Yes, maybe it has become clearer now :-) > > Cheers, Oliver