示例#1
0
 internal ActorRuntime(IActorSystem system, ActorGrain grain)
 {
     System     = system;
     Timers     = new TimerService(grain);
     Reminders  = new ReminderService(grain);
     Activation = new ActivationService(grain);
 }
示例#2
0
        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();
        }
示例#3
0
        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);
        }
示例#4
0
 public static Task Subscribe <TItem>(this StreamRef <TItem> stream, ActorGrain actor) =>
 stream.Subscribe(actor, new SubscribeReceiveItem());
示例#5
0
        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);
        }
示例#6
0
 public static Task Resume <TItem>(this StreamRef <TItem> stream, ActorGrain actor) =>
 stream.Resume(actor, new ResumeReceiveItem());
示例#7
0
 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);
 }