public void Register(string name, IActorInvoker invoker) { Requires.NotNullOrWhitespace(name, nameof(name)); Requires.NotNull(invoker, nameof(invoker)); invokers[name] = invoker; }
public void Register(string name, IActorInvoker invoker) { Requires.NotNullOrWhitespace(name, nameof(name)); Requires.NotNull(invoker, nameof(invoker)); if (invokers.ContainsKey(name)) { throw new InvalidOperationException($"Invoker with name '{name}' is already registered"); } invokers.Add(name, invoker); }
Task Activate() { var path = ActorPath.From(Actor.Name, IdentityOf(this)); var system = ServiceProvider.GetRequiredService <ClusterActorSystem>(); var activator = ServiceProvider.GetRequiredService <IActorActivator>(); var runtime = new ActorRuntime(system, this); instance = Actor.Activate(this, path, runtime, activator); invoker = Actor.Invoker(system.Pipeline); return(invoker.OnActivate(instance)); }
internal ActorType(Type actor, Type endpoint) { this.actor = actor; Name = ActorTypeName.Of(actor); Sticky = StickyAttribute.IsApplied(actor); keepAliveTimeout = Sticky ? TimeSpan.FromDays(365 * 10) : KeepAliveAttribute.Timeout(actor); Invoker = InvocationPipeline.Instance.GetInvoker(actor, InvokerAttribute.From(actor)); interleavePredicate = ReentrantAttribute.MayInterleavePredicate(actor); dispatcher = new Dispatcher(actor); dispatchers.Add(actor, dispatcher); Init(endpoint); }
protected ActorInvoker(IActorInvoker next = null) { Next = next ?? DefaultActorInvoker.Instance; }
public void Register(IActorInvoker invoker) { Requires.NotNull(invoker, nameof(invoker)); DefaultInvoker = invoker; }
/// <summary> /// Registers named actor invoker (interceptor). For this invoker to be used an actor need /// to specify its name via <see cref="InvokerAttribute"/> attribute. /// The invoker is inherited by all subclasses. /// </summary> /// <param name="name">The name of the invoker</param> /// <param name="invoker">The invoker.</param> public ClusterConfigurator ActorInvoker(string name, IActorInvoker invoker) { pipeline.Register(name, invoker); return(this); }
/// <summary> /// Registers global actor invoker (interceptor). This invoker will be used for every actor /// which doesn't specify an individual invoker via <see cref="InvokerAttribute"/> attribute. /// </summary> /// <param name="global">The invoker.</param> public ClusterConfigurator ActorInvoker(IActorInvoker global) { pipeline.Register(global); return(this); }