Esempio n. 1
0
 internal ClientActorSystem(
     Assembly[] assemblies,
     IServiceProvider serviceProvider,
     IActorRefMiddleware middleware = null)
     : base(assemblies, serviceProvider, middleware)
 {
     grainFactory = serviceProvider.GetService <IGrainFactory>();
 }
Esempio n. 2
0
        protected ActorSystem(Assembly[] assemblies, IServiceProvider serviceProvider)
        {
            this.serviceProvider    = serviceProvider;
            this.grainFactory       = serviceProvider.GetService <IGrainFactory>();
            this.actorRefMiddleware = serviceProvider.GetService <IActorRefMiddleware>() ?? DefaultActorRefMiddleware.Instance;

            Register(assemblies);
        }
Esempio n. 3
0
 internal ClusterActorSystem(
     Assembly[] assemblies,
     IServiceProvider serviceProvider,
     ActorMiddlewarePipeline pipeline,
     IActorRefMiddleware middleware = null)
     : base(assemblies, serviceProvider, middleware)
 {
     Register(pipeline, assemblies);
 }
Esempio n. 4
0
        protected ActorSystem(Assembly[] assemblies, IServiceProvider serviceProvider)
        {
            this.serviceProvider     = serviceProvider;
            this.grainFactory        = serviceProvider.GetService <IGrainFactory>();
            this.actorRefMiddleware  = serviceProvider.GetService <IActorRefMiddleware>();
            this.streamRefMiddleware = serviceProvider.GetService <IStreamRefMiddleware>();

            Register(assemblies);
        }
Esempio n. 5
0
        /// <summary>
        /// Registers global <see cref="ActorRef"/> middleware (interceptor)
        /// </summary>
        /// <param name="middleware">The middleware.</param>
        public OrleankkaClientOptions ActorRefMiddleware(IActorRefMiddleware middleware)
        {
            Requires.NotNull(middleware, nameof(middleware));

            if (this.middleware != null)
                throw new InvalidOperationException("ActorRef middleware has been already registered");

            this.middleware = middleware;
            return this;
        }
Esempio n. 6
0
        /// <summary>
        /// Registers direct client <see cref="ActorRef"/> middleware (interceptor)
        /// </summary>
        /// <param name="middleware">The middleware.</param>
        public OrleankkaClusterOptions DirectClientActorRefMiddleware(IActorRefMiddleware middleware)
        {
            Requires.NotNull(middleware, nameof(middleware));

            if (directClientMiddleware != null)
            {
                throw new InvalidOperationException("ActorRef middleware for direct client has been already registered");
            }

            directClientMiddleware = middleware;
            return(this);
        }
Esempio n. 7
0
        public HttpActorSystem(HttpClient client, JsonSerializerOptions serializer, ActorRouteMapper mapper, IActorRefMiddleware middleware = null)
        {
            if (!client.BaseAddress.AbsoluteUri.EndsWith("/"))
            {
                throw new InvalidOperationException("The base address should end with /");
            }

            this.mapper     = mapper;
            this.client     = client;
            this.serializer = serializer;
            this.middleware = middleware ?? DefaultActorRefMiddleware.Instance;
        }
Esempio n. 8
0
 internal ActorRef(ActorPath path, IActorGrain endpoint, IActorRefMiddleware middleware)
     : this(path)
 {
     this.endpoint   = endpoint;
     this.middleware = middleware;
 }
Esempio n. 9
0
 protected ActorRefMiddleware(IActorRefMiddleware next = null) =>
 this.next = next ?? DefaultActorRefMiddleware.Instance;