Package io.dapr.actors.runtime

# Class AbstractActor

java.lang.Object
io.dapr.actors.runtime.AbstractActor

    public abstract class AbstractActor
    extends java.lang.Object

Represents the base class for actors. The base type for actors, that provides the common functionality for actors. The state is preserved across actor garbage collections and fail-overs.

- ## Constructor Summary

  Constructors
  Modifier | Constructor | Description
  --- | --- | ---
  `protected` | `AbstractActor​(ActorRuntimeContext runtimeContext, ActorId id)` | Instantiates a new Actor.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `protected ActorStateManager` | `getActorStateManager()` | Returns the state store manager for this Actor.
  `protected ActorId` | `getId()` | Returns the id of the actor.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `onActivate()` | Callback function invoked after an Actor has been activated.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `onDeactivate()` | Callback function invoked after an Actor has been deactivated.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `onPostActorMethod​(ActorMethodContext actorMethodContext)` | Callback function invoked after method is invoked.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `onPreActorMethod​(ActorMethodContext actorMethodContext)` | Callback function invoked before method is invoked.
  `protected <T> reactor.core.publisher.Mono<java.lang.Void>` | `registerActorTimer​(java.lang.String timerName, java.lang.String callback, T state, java.time.Duration dueTime, java.time.Duration period)` | Registers a Timer for the actor.
  `protected <T> reactor.core.publisher.Mono<java.lang.Void>` | `registerReminder​(java.lang.String reminderName, T state, java.time.Duration dueTime, java.time.Duration period)` | Registers a reminder for this Actor.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `saveState()` | Saves the state of this Actor.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `unregisterReminder​(java.lang.String reminderName)` | Unregisters a Reminder.
  `protected reactor.core.publisher.Mono<java.lang.Void>` | `unregisterTimer​(java.lang.String timerName)` | Unregisters an Actor timer.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractActor

    protected AbstractActor​(ActorRuntimeContext runtimeContext, ActorId id)
    Instantiates a new Actor.
    Parameters:
      `runtimeContext` - Context for the runtime.
      `id` - Actor identifier.

- ## Method Details

  - ### getId

    protected ActorId getId()
    Returns the id of the actor.
    Returns:
      Actor id.

  - ### getActorStateManager

    protected ActorStateManager getActorStateManager()
    Returns the state store manager for this Actor.
    Returns:
      State store manager for this Actor

  - ### registerReminder

    protected <T> reactor.core.publisher.Mono<java.lang.Void> registerReminder​(java.lang.String reminderName, T state, java.time.Duration dueTime, java.time.Duration period)
    Registers a reminder for this Actor.
    Type Parameters:
      `T` - Type of the state object.
    Parameters:
      `reminderName` - Name of the reminder.
      `state` - State to be send along with reminder triggers.
      `dueTime` - Due time for the first trigger.
      `period` - Frequency for the triggers.
    Returns:
      Asynchronous void response.

  - ### registerActorTimer

    protected <T> reactor.core.publisher.Mono<java.lang.Void> registerActorTimer​(java.lang.String timerName, java.lang.String callback, T state, java.time.Duration dueTime, java.time.Duration period)
    Registers a Timer for the actor. A timer name is autogenerated by the runtime to keep track of it.
    Type Parameters:
      `T` - Type for the state to be passed in to timer.
    Parameters:
      `timerName` - Name of the timer, unique per Actor (auto-generated if null).
      `callback` - Name of the method to be called.
      `state` - State to be passed it to the method when timer triggers.
      `dueTime` - The amount of time to delay before the async callback is first invoked. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately.
      `period` - The time interval between invocations of the async callback. Specify negative one (-1) milliseconds to disable periodic signaling.
    Returns:
      Asynchronous result.

  - ### unregisterTimer

    protected reactor.core.publisher.Mono<java.lang.Void> unregisterTimer​(java.lang.String timerName)
    Unregisters an Actor timer.
    Parameters:
      `timerName` - Name of Timer to be unregistered.
    Returns:
      Asynchronous void response.

  - ### unregisterReminder

    protected reactor.core.publisher.Mono<java.lang.Void> unregisterReminder​(java.lang.String reminderName)
    Unregisters a Reminder.
    Parameters:
      `reminderName` - Name of Reminder to be unregistered.
    Returns:
      Asynchronous void response.

  - ### onActivate

    protected reactor.core.publisher.Mono<java.lang.Void> onActivate()
    Callback function invoked after an Actor has been activated.
    Returns:
      Asynchronous void response.

  - ### onDeactivate

    protected reactor.core.publisher.Mono<java.lang.Void> onDeactivate()
    Callback function invoked after an Actor has been deactivated.
    Returns:
      Asynchronous void response.

  - ### onPreActorMethod

    protected reactor.core.publisher.Mono<java.lang.Void> onPreActorMethod​(ActorMethodContext actorMethodContext)
    Callback function invoked before method is invoked.
    Parameters:
      `actorMethodContext` - Method context.
    Returns:
      Asynchronous void response.

  - ### onPostActorMethod

    protected reactor.core.publisher.Mono<java.lang.Void> onPostActorMethod​(ActorMethodContext actorMethodContext)
    Callback function invoked after method is invoked.
    Parameters:
      `actorMethodContext` - Method context.
    Returns:
      Asynchronous void response.

  - ### saveState

    protected reactor.core.publisher.Mono<java.lang.Void> saveState()
    Saves the state of this Actor.
    Returns:
      Asynchronous void response.