public static IServiceCollection AddArticleServiceActorHost(this IServiceCollection services, int capacity = 10000)
        {
            services.VerifyNotNull(nameof(services));

            services.AddSingleton <IActorHost>(x =>
            {
                ILoggerFactory loggerFactory = x.GetRequiredService <ILoggerFactory>();

                IActorHost host = new ActorHost(capacity, loggerFactory);
                host.Register <IArticlePackageActor>(() => x.GetRequiredService <IArticlePackageActor>());
                host.Register <IDirectoryActor>(() => x.GetRequiredService <IDirectoryActor>());

                return(host);
            });

            return(services);
        }
Beispiel #2
0
        public static IServiceCollection AddArtifactStore(this IServiceCollection services, int actorCapacity = 10000)
        {
            services.VerifyNotNull(nameof(services));

            services.AddSingleton <IArtifactStorageFactory, ArtifactStorageFactory>();
            services.AddSingleton <IArtifactStoreService, ArtifactStoreService>();

            services.AddTransient <IArtifactPayloadActor, ArtifactPayloadActor>();

            services.AddSingleton <IActorHost>(x =>
            {
                ILoggerFactory loggerFactory = x.GetRequiredService <ILoggerFactory>();

                IActorHost host = new ActorHost(actorCapacity, loggerFactory);
                host.Register <IArtifactPayloadActor>(() => x.GetRequiredService <IArtifactPayloadActor>());

                return(host);
            });

            return(services);
        }