Hi,

Some more newbie questions, so to keep my testing/learning, i want to use 
actor to process message. So in my map() i invoke the actor. 

1, is this a good use of actor here?
2, Await.result is blocking, in this case is it a good idea to do 
non-blocking (or possible)?


Thanks
Shannon






public ProducerMessage.Message<SpecificRecord, SpecificRecord, 
ConsumerMessage.Committable> apply(
CommittableMessage<SpecificRecord, SpecificRecord> msg)
throws Exception {
//logger.debug(Thread.currentThread().getName() + 
"msg---------------------------------------------------" + msg); 
logger.debug(Thread.currentThread().getName() + " 
 msg---------------------------------------------------" + 
msg.record().value().getClass()); 
final Timeout timeout = new Timeout(5, TimeUnit.SECONDS);
Future<Object> future = Patterns.ask(tpactor, msg, timeout);
logger.debug(Thread.currentThread().getName() + " 
 asking---------------------------------------------------" + 
msg.record().value().getClass()); 
CommittableMessage<SpecificRecord, SpecificRecord> outmsg = 
(CommittableMessage<SpecificRecord, SpecificRecord>) Await.result(future, 
timeout.duration());
logger.debug(Thread.currentThread().getName() + " 
 back---------------------------------------------------" + 
outmsg.record().value().getClass()); 
return new ProducerMessage.Message<SpecificRecord, SpecificRecord, 
ConsumerMessage.Committable>(
new ProducerRecord<SpecificRecord, SpecificRecord>("akkatest2", 
outmsg.record().key(), outmsg.record().value()), 
outmsg.committableOffset());
}

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to