ActorStateProvider Interface
public interface ActorStateProvider extends StateProviderReplica
Represents the interface that an actor state provider needs to implement for actor runtime to communicate with it.
Method Summary
Modifier and Type | Method and Description |
---|---|
CompletableFuture<?> |
actorActivatedAsync(ActorId actorId, CancellationToken cancellationToken)
This method is invoked as part of the activation process of the actor with the specified Id. |
CompletableFuture<Boolean> |
containsStateAsync(ActorId actorId, String stateName, CancellationToken cancellationToken)
Checks whether actor state provider contains an actor state with specified state name. |
CompletableFuture<?> |
deleteReminderAsync(ActorId actorId, String reminderName, CancellationToken cancellationToken)
Deletes the specified actor reminder if it exists. |
CompletableFuture<?> |
deleteRemindersAsync(Map<ActorId, Collection<String>> reminderNames, CancellationToken cancellationToken)
Deletes the specified set of reminders |
CompletableFuture<List<String>> |
enumerateStateNamesAsync(ActorId actorId, CancellationToken cancellationToken)
Creates an enumerable of all the state names associated with specified actor.
Remarks:The enumerator returned from actor state provider is safe to use concurrently with reads and writes to the state provider. It represents a snapshot consistent view of the state provider. |
CompletableFuture<Paged |
getActorsAsync(int numItemsToReturn, ContinuationToken continuationToken, CancellationToken cancellationToken)
Gets ActorIds from the State Provider.
Remarks: The |
void |
initialize(ActorTypeInformation actorTypeInformation)
Initializes the actor state provider with type information of the actor type associated with it. |
CompletableFuture<Actor |
loadRemindersAsync(CancellationToken cancellationToken)
Loads all the reminders contained in the actor state provider. |
<T> CompletableFuture<T> |
loadStateAsync(ActorId actorId, String stateName, CancellationToken cancellationToken)
Loads the actor state associated with the specified state name. |
CompletableFuture<?> |
reminderCallbackCompletedAsync(ActorId actorId, ActorReminder reminder, CancellationToken cancellationToken)
Invoked when a reminder fires and finishes executing its callback receiveReminderAsync(String reminderName, byte[] context, Duration timeSpan, Duration period) successfully |
CompletableFuture<?> |
removeActorAsync(ActorId actorId, CancellationToken cancellationToken)
Removes all the existing states and reminders associated with specified actor atomically. |
CompletableFuture<?> |
saveReminderAsync(ActorId actorId, ActorReminder reminder, CancellationToken cancellationToken)
Saves the specified actor reminder. If an actor reminder with given name does not exist, it adds the actor reminder otherwise existing actor reminder with same name is updated. |
CompletableFuture<?> |
saveStateAsync(ActorId actorId, List<ActorStateChange> stateChanges, CancellationToken cancellationToken)
Saves the specified set of actor state changes atomically.
Remarks: The collection of state changes should contain only one item for a given state name. The save operation will fail on trying to add an actor state which already exists or update/remove an actor state which does not exist. |
Inherited Members
Method Details
actorActivatedAsync
public CompletableFuture actorActivatedAsync(ActorId actorId, CancellationToken cancellationToken)
This method is invoked as part of the activation process of the actor with the specified Id.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
containsStateAsync
public CompletableFuture
Checks whether actor state provider contains an actor state with specified state name.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
deleteReminderAsync
public CompletableFuture deleteReminderAsync(ActorId actorId, String reminderName, CancellationToken cancellationToken)
Deletes the specified actor reminder if it exists.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
deleteRemindersAsync
public CompletableFuture deleteRemindersAsync(Map
Deletes the specified set of reminders
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
enumerateStateNamesAsync
public CompletableFuture> enumerateStateNamesAsync(ActorId actorId, CancellationToken cancellationToken)
Creates an enumerable of all the state names associated with specified actor.
Remarks:The enumerator returned from actor state provider is safe to use concurrently with reads and writes to the state provider. It represents a snapshot consistent view of the state provider.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
getActorsAsync
public CompletableFuture
Gets ActorIds from the State Provider.
Remarks: The
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
initialize
public void initialize(ActorTypeInformation actorTypeInformation)
Initializes the actor state provider with type information of the actor type associated with it.
Parameters:
loadRemindersAsync
public CompletableFuture
Loads all the reminders contained in the actor state provider.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
loadStateAsync
public
Loads the actor state associated with the specified state name.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
reminderCallbackCompletedAsync
public CompletableFuture reminderCallbackCompletedAsync(ActorId actorId, ActorReminder reminder, CancellationToken cancellationToken)
Invoked when a reminder fires and finishes executing its callback receiveReminderAsync(String reminderName, byte[] context, Duration timeSpan, Duration period) successfully
Parameters:
Returns:
removeActorAsync
public CompletableFuture removeActorAsync(ActorId actorId, CancellationToken cancellationToken)
Removes all the existing states and reminders associated with specified actor atomically.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
saveReminderAsync
public CompletableFuture saveReminderAsync(ActorId actorId, ActorReminder reminder, CancellationToken cancellationToken)
Saves the specified actor reminder. If an actor reminder with given name does not exist, it adds the actor reminder otherwise existing actor reminder with same name is updated.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
saveStateAsync
public CompletableFuture saveStateAsync(ActorId actorId, List
Saves the specified set of actor state changes atomically.
Remarks: The collection of state changes should contain only one item for a given state name. The save operation will fail on trying to add an actor state which already exists or update/remove an actor state which does not exist.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
Applies to
Azure SDK for Java