Ejemplo n.º 1
0
        internal ClusterActorSystem(
            ClusterConfiguration configuration,
            Assembly[] assemblies,
            Action <IServiceCollection> di,
            ActorInvocationPipeline pipeline,
            IActorRefInvoker invoker)
            : base(invoker)
        {
            Pipeline = pipeline;

            using (Trace.Execution("Orleans silo initialization"))
            {
                var builder = new SiloHostBuilder()
                              .UseConfiguration(configuration)
                              .ConfigureServices(services =>
                {
                    services.AddSingleton <IActorSystem>(this);
                    services.AddSingleton(this);
                    services.TryAddSingleton <IActorActivator>(x => new DefaultActorActivator(x));
                    services.AddSingleton <Func <MethodInfo, InvokeMethodRequest, IGrain, string> >(DashboardIntegration.Format);

                    di?.Invoke(services);
                });

                builder.ConfigureApplicationParts(apm => apm
                                                  .AddFromAppDomain()
                                                  .WithCodeGeneration());

                Host = builder.Build();
            }

            Silo = Host.Services.GetRequiredService <Silo>();
            Initialize(Host.Services);
        }
Ejemplo n.º 2
0
 internal ClientActorSystem(
     ClientConfiguration configuration,
     Assembly[] assemblies,
     Action <IServiceCollection> di,
     IActorRefInvoker invoker)
     : base(invoker)
 {
     this.configuration = configuration;
     this.assemblies    = assemblies;
     this.di            = di;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Registers global <see cref="ActorRef"/> invoker (interceptor)
        /// </summary>
        /// <param name="invoker">The invoker.</param>
        public ClientConfigurator ActorRefInvoker(IActorRefInvoker invoker)
        {
            Requires.NotNull(invoker, nameof(invoker));

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

            this.invoker = invoker;
            return(this);
        }
Ejemplo n.º 4
0
        internal ClusterActorSystem(ClusterConfiguration configuration, Action <IServiceCollection> di, ActorInvocationPipeline pipeline, IActorRefInvoker invoker)
            : base(invoker)
        {
            this.di  = di;
            Pipeline = pipeline;

            current = this;
            configuration.UseStartupType <Startup>();

            using (Trace.Execution("Orleans silo initialization"))
            {
                Host = new SiloHost(Dns.GetHostName(), configuration);
                Host.LoadOrleansConfig();
                Host.InitializeOrleansSilo();
            }

            Silo = Host.GetSilo();
            Initialize(Silo.GetServiceProvider());
        }
Ejemplo n.º 5
0
 protected ActorRefInvoker(IActorRefInvoker next = null)
 {
     this.next = next ?? DefaultActorRefInvoker.Instance;
 }
Ejemplo n.º 6
0
 protected ActorSystem(IActorRefInvoker invoker = null)
 {
     this.invoker = invoker ?? DefaultActorRefInvoker.Instance;
 }
Ejemplo n.º 7
0
 internal ActorRef(ActorPath path, IActorEndpoint endpoint, IActorRefInvoker invoker)
     : this(path)
 {
     this.endpoint = endpoint;
     this.invoker  = invoker;
 }