Skip to content

@ActorMethod to override method's name for client and service #444

@artursouza

Description

@artursouza

Today, we have Actor for Dapr implemented in 3 languages: C#, Java and Python. Each language has their own convention in how a method should be named. Then, actor method invocation does not work cross language without the caller breaking the language's convention when defining the Actor's interface.

Example of Actor interface in the service side in C#:

    public interface IMyActor : IActor
    {      
        Task<int> IncrementAndGetAsync(int delta);
    }

Now, the same interface could be represented at the caller's side in Java:

@ActorType(name = "MyActor")
public interface MyActor {
  @ActorMethod(name = "IncrementAndGetAsync")
  int incrementAndGet(int delta);
}

Instead of:

@ActorType(name = "MyActor")
public interface MyActor {
  int IncrementAndGetAsync(int delta);
}

This feature should also work the other way around, where the Java service would accept "IncrementAndGetAsync" instead of the native method name.

Note: The SDK already contains the @ActorMethod annotation but it does not have the name attribute.

Relates to: dapr/dapr#1165

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions