You must anyway design for that messages may be lost (e.g. implement acknowledgments and resending) and the first messages are no different. You can subscribe to cluster membership events and wait sending until expected nodes are seen as Up, but it's not a guarantee.
Regards, Patrik On Sun, Oct 30, 2016 at 1:41 AM, Federico Jakimowicz <[email protected]> wrote: > Hi, > > I was giving it a try to the akka cluster feature. I made two systems to > say front and backend. Is just for giving it a try, nothing real. > > On the front end system I have a router that routes messages to actors in > the backend system. > The odd thing i found is that if i send a message to the router in the > frontend as soon as it is created ( being the backend system up an > running ) then the message goes to frontend deadletters. > If I add a delay for instance sleep the thread a second before sending a > message then it reaches the backend actor. > It seemed to me a bit odd, is this something expected? > > part of the code in the front end system > Cluster.get(system).registerOnMemberUp(new Runnable() { > public void run() { > ActorRef processor = > system.actorOf(Props.create(CommercePaymentActor.class), > "creditCardPaymentActor"); > processor.tell("Message from front End", ActorRef.noSender()); > } > }); > > > ................ > > public class CommercePaymentActor extends UntypedActor { > private final ActorRef creditCardPaymentRouter; > > public CommercePaymentActor() { > creditCardPaymentRouter = getContext().actorOf(FromConfig.getInstance(). > props(), > "creditCardPaymentRouter"); > } > > @Override > public void onReceive(Object event) throws Exception { > Thread.sleep(1000); > creditCardPaymentRouter.tell(event, getSelf()); > } > } > ................ > > the router config: > > akka.actor.deployment { > /creditCardPaymentActor/creditCardPaymentRouter { > # Router type provided by metrics extension. > router = "akka.cluster.metrics.AdaptiveLoadBalancingGroup" > metrics-selector = mix > # > routees.paths = ["/user/creditCardPaymentProcessor"] > cluster { > enabled = on > use-role = backend > allow-local-routees = off > } > } > } > > -- > >>>>>>>>>> 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. > -- Patrik Nordwall Akka Tech Lead Lightbend <http://www.lightbend.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 [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.
