Skip to content

Unable to implement reminders for my own StateProvider implementation #345

Open
@ssteinau

Description

@ssteinau

Describe the bug
ActorService allows implementing custom actor state providers. The Interface IActorStateProvider requires implementing the method

    Task<ReminderPagedResult<KeyValuePair<ActorId, List<ActorReminderState>>>> GetRemindersAsync(
        int numItemsToReturn, ...); // parameters omitted for brevity

The problem is in the return type "List<ActorReminderState>". ActorReminderState is public non-sealed class and as such can be subclassed, yet its constructor is internal - One cannot create instances of the subclass.

Related issues cascade through the code as well:.ActorStateReminder constructor parameters are internal classes as well,
To Reproduce

Create new project, import the actors NuGet package, create a subclass of ActorReminder state with a 3-param constructor that calls the base class. Compiler error because the base class constructor is internal. Example:

public class SubActorReminderState : ActorReminderState, IActorReminderState
{

  /*Properties
  */
  //Constructor
    public SubActorReminderState(ActorReminderData reminder, TimeSpan currentLogicalTime, ReminderCompletedData reminderCompletedData) : base(reminder,currentLogicalTime,reminderCompletedData) //calling base gives compiler error

Expected behavior

Be able to implement reminders for the state provider.
Possible solutions:

  • Make the ActorReminderState constructor and parameter classes public
  • Make GetRemindersAsync return List<IActorReminderState>

Additional context

  • There is an Interface IActorReminderState that ActorReminderState implements. The new signature of GetRemindersAsync could be

      Task<ReminderPagedResult<KeyValuePair<ActorId, List<IActorReminderState>>>> GetRemindersAsync(
          int numItemsToReturn, ...); // parameters omitted for brevity
    

and a user can then implement the IActorReminderState interface, ActorReminderState can stay as-is.

Caveat: the interface would have to include additional properties and methods, non-interface properties and methods of ActorReminderState are used throughout the project.

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