Cancel service fabric actor activation on ActivateAsync?

75 views Asked by At

Is it possible to cancel activation on ActivateAsync, based on initialization code and the ActorProxy.Create to return null? For example, a web service asks the state of a device actor. Device with this Id does not exist actually. Can I return null on the actor create?

1

There are 1 answers

2
LoekD On BEST ANSWER

No, for two reasons.

  1. The object returned from ActorProxy.Create is a proxy that can interact with a (remote) Actor, it is not the Actor itself.
  2. An Actor is automatically created just in time, if it's not already there when interacting with it, so you don't need to worry about its life cycle.

To find out which Actors exist, you can interact with the ActorService. PagedResult<ActorInformation> page = await actorServiceProxy.GetActorsAsync(continuationToken, cancellationToken);