akka/akka-core

Group router always drops first message

Open

#31,297 opened on Mar 30, 2022

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Scala (13,277 stars) (3,547 forks)batch import
1 - triagedhelp wantedt:typed

Description

Hello,

I have a cluster setup of 2 nodes. One node has service registered with services key over receptionist. Another node is using a group router to contact service on the first node.

Group router documentation has an example with the statement:

// the group router will stash messages until it sees the first listing of registered services from the 
// receptionist, so it is safe to send messages right away
for (int i = 0; i < 10; i++) {
    router.tell(new Worker.DoLog("msg " + i));
}

It states that it is safe to send messages immediately as they are stashed. But it behaves differently. Whenever a new group router is created, a new/first message gets dropped by the group router that is sent to the service right after the group router creation.

I also noted that subscriptions to the receptionist return 0 service instances on the first listing provided, while the node with the service is actually up and running. Only the second listing notification provides correct information. Seems like there is something to do with the receptionist and probably listing notifications.

Scala binary version 2.13 Akka version 2.6.19

Br, Alexander

Contributor guide