Skip to content

Integrate Actors APIs with Spring #1614

@salaboy

Description

@salaboy

Integrating the Actors API with Spring should follow the same approach as Workflows.
For example:

  • Actor registration should happen when the Spring Boot application context load, it shouldn't be done by the user. -> For example: ActorRuntime.getInstance().registerActor(DemoActorImpl.class); -> Provide @EnableDaprActors annotation.
  • All ActorRuntime configuration options should be handled by Spring properties. For example: ActorRuntime.getInstance().getConfig().setDrainOngoingCallTimeout(Duration.ofSeconds(10));
  • Investigate how to handle annotations @ActorType and @ActorMethod. Right now actors need to extend AbstractActor, but these are not managed Spring beans, making it difficult to integrate with the ecosystem.
    • It would be great to not need to extends AbstractActor as this can be automatically done by the framework.
    • For state manager -> super.getActorStateManager().set("lastmessage", something).block(); it would be great to have access by using Spring @Autowired in the Actor implementation.

The current approach push the user to define an interface annotated with @ActorType and @ActorMethod and then an implementation with the logic. Next create an implementation class that must extend AbstractActor. For a better developer experience, the framework (Spring integration) can collapse this steps into a single annotated implementation class.

This will require some investigation to common use cases and patterns about how users define their actors.

Check also: https://github.com/dapr/java-sdk/tree/master/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions