Thanks for your quick answer one question, if I have 5 persistence actor instances they belong to the same Class,* do they conflict each other when persist data or recover data?*
On Thursday, July 3, 2014 1:34:02 PM UTC+8, Patrik Nordwall wrote: > > You missed the call to *persist*. > > @Override > public void onReceiveCommand(Object message) throws Exception { > persist("test", new Procedure<String>() { > public void apply(String evt) throws Exception { > dataList.add("test"); > if(dataList.size()>10) { > throw new Exception(); > } > } > }); > > } > > I'm curious to know if you found that code in the documentation or > samples, because then we would like to correct it. > > Regards, > Patrik > > > On Thu, Jul 3, 2014 at 4:12 AM, <simaf...@gmail.com <javascript:>> wrote: > >> >> Hi All, >> >> I do not very understand the UntypedPersistentActor. I have 2 questions >> >> *question 1*: we have to overide the method persistenceId. It can return >> any String value, but must be unique, right? >> >> @Override >> public String persistenceId() { >> return "test-id-1"; >> } >> *question 2*: I have the below test code. When throws exception in the >> actor(refer to the red color code), I believe the variable dataList will be >> recovered. >> But I debugged the code, the dataList wasn't revocered. *Did I miss >> anything?* >> >> public class DemoAggregatorActor extends UntypedPersistentActor { >> >> private List<String> dataList = new ArrayList<String>(100); >> >> >> @Override >> public void onReceiveRecover(Object msg) { >> if (msg instanceof String) { >> dataList.add((String)msg); >> } else { >> unhandled(msg); >> } >> } >> >> @Override >> public void onReceiveCommand(Object message) throws Exception { >> >> dataList.add("test"); >> if(dataList.size()>10){ >> *throw new Exception();* >> } >> } >> } >> >> -- >> >>>>>>>>>> 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 akka-user+...@googlegroups.com <javascript:>. >> To post to this group, send email to akka...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Patrik Nordwall > Typesafe <http://typesafe.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.