This is a jedis thing, the subscriber needs to run in its own thread, which blocks listening for published messages.
You might look at https://github.com/etaty/rediscala for a non blocking/akka based version Might try On Thursday, January 16, 2014 10:16:25 PM UTC-8, rkuhn wrote: > > Hi Ömer, > > this is most probably a question concerning Jedis, not Akka. > > Regards, > > Roland > > 17 jan 2014 kl. 01:52 skrev Ömer Faruk Gül <[email protected]<javascript:> > >: > > Hi, > > I have a problem, > > The following two lines (in play2.1) blocks the constructor or preStart: > > Jedis j = > play.Play.application().plugin(RedisPlugin.class).jedisPool().getResource(); > j.subscribe(new MyListener(), CHANNEL); > > Actually in the original example I'm following it was called in an another > thread as follows: > > Akka.system().scheduler().scheduleOnce( > Duration.create(10, TimeUnit.MILLISECONDS), > new Runnable() { > public void run() { > Jedis j = > play.Play.application().plugin(RedisPlugin.class).jedisPool().getResource(); > j.subscribe(new MyListener(), CHANNEL); > } > }, > Akka.system().dispatcher() > ); > > Why does subscribe blocks the code? What I mean by blocking is the Logging > lines after the j.subscribe(new MyListener(), CHANNEL); line doesn't work. > > Thanks. > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected]<javascript:> > . > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > *Dr. Roland Kuhn* > *Akka Tech Lead* > Typesafe <http://typesafe.com/> – Reactive apps on the JVM. > twitter: @rolandkuhn > <http://twitter.com/#!/rolandkuhn> > > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
