Hi,

I have an scenario where all messages come to a single main actor and such 
actor in my previous version was processing each message in a Future, 
realistically speaking I wouldn't expect to be processing more than CPUs 
messages concurrently, but I need the main actor to dispatch such messages 
ASAP to a processor, so I have a very simple round robin router that has 
all the created processor actors.

Do you think that will scale better than using Futures if, say, I have a 
high burst of messages?

Here is a fragment of my main actor:

  ...
  ...

  private final Router strategyProcessors;

  public StrategySupervisor() {
    strategyProcessors = new Router(new RoundRobinRoutingLogic(), IntStream.
range(0, Runtime.getRuntime().availableProcessors()).
      mapToObj(i -> new ActorRefRoutee(context().actorOf(Props.create(new 
StrategyProcessorCreator(this))))).
      collect(Collectors.toList())
    );
  }

  @Override
  protected ChildActorCreator<Integer, Strategy, StrategySupervisor, 
StrategyProcessor> creator(Strategy strategy) {
    return new StrategyProcessorCreator(this);
  }

  // Called by onReceive(...), part of a template pattern.
  @Override
  protected void processMessage(Object message) {
    if (message instanceof FixSignal) {
      strategyProcessors.route(message, noSender());
    } else {
      unhandled(message);
    }
  }

  ...
  ...

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to