0
votes

Here i created a router with SmallestMailboxRouter

ActorRef actorRouter = this?.getContext()?.actorOf(new Props(RuleStandardActor.class).withRouter(new SmallestMailboxRouter(38)),"standardActorRouter")

Now in for loop i created 38 actors

    for(int i=0;i <38;i++) {
    ruleStandardActorRouter?.tell(new StandardActorMessage(standard: standard, responseVO: responseVO, report: report), getSelf());
}

each actor will process the logic and returns the score and message . i am receiving the message by overriding onreceive method and adding them to a list

If i run the program multiple times i am getting different scores. but it should return always same score as i am giving same input.

if (message instanceof StandardActorResponse) {
        StandardActorResponse standardActorResponse = message
        standardActorResponseList?.add(standardActorResponse)

}

here standardActorResponse contains message and score . if i am using same logic by just using for loop instead of akka framework i am reciving conisstant result. but in akka randomly getting different results. for example i have some rules like loginexistence and navigationexistence and alertsexistence rules. i have given one html source to these rules to check whether the html source have login,alerts,navigation links in that source. some times i am getting login doesnt exists, some times navigation doesnt exist, some times alerts doesnt exists by using akka routers and actors. but if i use for loop i am always getting same result

can any one help me to find the problem. i am using akka 2.1.4

1

1 Answers

1
votes

Probably the for loop is already finished before the mailbox size is recognised. Try adding a sleep in the for loop to see the results.