Configure dispatcher in Akka typed actor

I´m working with Akka typed, and I´m not able checking in the official documentation(https://doc.akka.io/docs/akka/current/typed/actors.html#actors), which I found really short, how to configure the Dispatcher in the Actor typed.

Here an example of my code

private int actorTimeout = Integer.parseInt(getProperty("environment.actor.timeout", "10"));

    @Autowired
    private AkkaTypedDAO akkaTypedDAO;

    private ActorSystem<AkkaTypedDTO> system;

    @PostConstruct
    private void initActor() {
        system = ActorSystem.create(akkaTypedDAO.daoWithSupervisor, "AkkaTypedDAO");
    }

    private final Behavior<CommandAkkaTyped> service = Actor.immutable((ctx, msg) -> {
        sendToDAO(msg.id).thenApply(either -> {
            msg.replyTo.tell(either);
            return either;
        });
        return Actor.same();
    });

    public final Behavior<CommandAkkaTyped> serviceWithSupervisor = Actor.supervise(service).onFailure(Exception.class, restart());

    private CompletionStage<Either<ConnectorErrorVO, EntityDaoDTO>> sendToDAO(MUSIn<AkkaTypedPayLoad> id) {
        return AskPattern.ask(system,
                (ActorRef<Either<ConnectorErrorVO, EntityDaoDTO>> replyTo) -> new AkkaTypedDTO(new EntityDaoDTO(musIn), replyTo),
                new Timeout(actorTimeout, TimeUnit.SECONDS), system.scheduler());
    }

Checking the new API in case I want to create passing the Props I have to pass quite a lot more classes.

def create[T](
  guardianBehavior: Behavior[T],
  name: String,
  guardianProps: Optional[Props],
  config: Optional[Config],
  classLoader: Optional[ClassLoader],
  executionContext: Optional[ExecutionContext]): ActorSystem[T] = {
  import scala.compat.java8.OptionConverters._
  apply(guardianBehavior, name, guardianProps.asScala.getOrElse(EmptyProps), config.asScala, 
  classLoader.asScala, executionContext.asScala)
}

When I create my ActorSystem how can I configure the dispatcher for my Actor.immutable?

First, I hope you haven’t misunderstood and create an ActorSystem for each actor/behavior.

I think there was something added to the documentation lately regarding the dispatcher, see https://doc.akka.io/docs/akka/current/typed/actor-lifecycle.html#creating-actors

Hi,

At the begging yes I did. Later I refactor the code using just one Actor system and I create the rest using the spawn.

Thanks for the documentation I’ll take look.

Regards