예제 #1
0
        protected Actor(string id, IActorRuntime runtime)
        {
            Requires.NotNull(runtime, "runtime");
            Requires.NotNullOrWhitespace(id, "id");

            Id      = id;
            Runtime = runtime;
        }
예제 #2
0
        /// <inheritdoc />
        public ClientRef ClientOf(string path)
        {
            Requires.NotNullOrWhitespace(path, nameof(path));

            var endpoint = ClientEndpoint.Proxy(path, grainFactory);

            return(new ClientRef(endpoint));
        }
예제 #3
0
        protected Actor(string id, IActorSystem system)
        {
            Requires.NotNull(system, "system");
            Requires.NotNullOrWhitespace(id, "id");

            Id     = id;
            System = system;
        }
예제 #4
0
        public static StreamPath From(string provider, string id)
        {
            Requires.NotNull(provider, nameof(provider));
            Requires.NotNull(id, nameof(id));
            Requires.NotNullOrWhitespace(id, nameof(id));

            return new StreamPath(provider, id);
        }
예제 #5
0
        protected Actor(string id, IActorRuntime runtime)
        {
            Requires.NotNull(runtime, nameof(runtime));
            Requires.NotNullOrWhitespace(id, nameof(id));

            Id      = id;
            Runtime = runtime;
        }
예제 #6
0
        protected Actor(string id, IActorRuntime runtime, Dispatcher dispatcher = null) : this()
        {
            Requires.NotNull(runtime, nameof(runtime));
            Requires.NotNullOrWhitespace(id, nameof(id));

            Runtime    = runtime;
            Dispatcher = dispatcher ?? ActorType.Dispatcher(GetType());
            Path       = GetType().ToActorPath(id);
        }
예제 #7
0
        public ActorTypeCodeAttribute(string code)
        {
            Requires.NotNullOrWhitespace(code, "code");

            if (code.Contains(ActorPath.Separator[0]))
            {
                throw new ArgumentException("Actor type code cannot contain path separator: " + code);
            }

            Code = code;
        }
예제 #8
0
        public ActorTypeAttribute(string name)
        {
            Requires.NotNullOrWhitespace(name, nameof(name));

            if (name.Contains(ActorPath.Separator[0]))
            {
                throw new ArgumentException($"Actor type name cannot contain path separator: {name}");
            }

            Name = name;
        }
        StreamSubscriptionSpecification(Type actor, string provider, Func <string, string> matcher, Func <object, string> selector = null, Func <object, bool> filter = null)
        {
            Requires.NotNullOrWhitespace(provider, nameof(provider));
            Requires.NotNull(matcher, nameof(matcher));

            Type          = ActorTypeName.Of(actor);
            Provider      = provider;
            this.matcher  = matcher;
            this.selector = selector;

            this.filter = filter ?? (x => true);
        }
예제 #10
0
        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);
        }
예제 #11
0
 public InvokerAttribute(string name)
 {
     Requires.NotNullOrWhitespace(name, nameof(name));
     Name = name;
 }
예제 #12
0
 public AutorunAttribute(string id)
 {
     Requires.NotNullOrWhitespace(id, nameof(id));
     Id = id;
 }
예제 #13
0
 public ReentrantAttribute(string callback)
 {
     Requires.NotNullOrWhitespace(callback, nameof(callback));
     this.callback = callback;
 }