internal ActorRuntime(IActorSystem system, ActorGrain grain) { System = system; Timers = new TimerService(grain); Reminders = new ReminderService(grain); Activation = new ActivationService(grain); }
public static async Task Unsubscribe <TItem>(this StreamRef <TItem> stream, ActorGrain actor) { Requires.NotNull(actor, nameof(actor)); var subscriptions = await stream.Subscriptions(); if (subscriptions.Count == 0) { return; } Debug.Assert(subscriptions.Count == 1, "We should keep only one active subscription per-stream per-actor"); await subscriptions[0].Unsubscribe(); }
public static async Task Subscribe(this StreamRef stream, ActorGrain actor, StreamFilter filter = null) { Requires.NotNull(actor, nameof(actor)); var subscriptions = await stream.Subscriptions(); if (subscriptions.Count == 1) { return; } Debug.Assert(subscriptions.Count == 0, "We should keep only one active subscription per-stream per-actor"); await stream.Subscribe(actor.ReceiveRequest, filter); }
public static Task Subscribe <TItem>(this StreamRef <TItem> stream, ActorGrain actor) => stream.Subscribe(actor, new SubscribeReceiveItem());
public static async Task Resume <TItem, TOptions>(this StreamRef <TItem> stream, ActorGrain actor, TOptions options) where TOptions : ResumeOptions { Requires.NotNull(actor, nameof(actor)); var subscriptions = await stream.Subscriptions(); if (subscriptions.Count == 0) { return; } Debug.Assert(subscriptions.Count == 1, "We should keep only one active subscription per-stream per-actor"); await subscriptions[0].Resume(actor.ReceiveRequest, options); }
public static Task Resume <TItem>(this StreamRef <TItem> stream, ActorGrain actor) => stream.Resume(actor, new ResumeReceiveItem());
public UnhandledMessageException(ActorGrain actor, object message, string details = "") : base($"An actor '{actor.GetType()}::{actor.Id}' cannot handle '{message.GetType()}'{details}") { }
public ActorGrainImplementation(Type type, IActorMiddleware middleware) { Middleware = middleware; Interface = ActorGrain.InterfaceOf(type); }