示例#1
0
        /// <summary>
        /// Registers and provisions an agent with custom implementation
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static AriesFrameworkBuilder RegisterMediatorAgent <T>(
            this AriesFrameworkBuilder builder,
            Action <AgentOptions> options)
            where T : class, IAgent
        {
            builder.AddAgentProvider();
            builder.Services.AddDefaultMessageHandlers();
            builder.Services.AddMessageHandler <MediatorForwardHandler>();
            builder.Services.AddMessageHandler <RoutingInboxHandler>();
            builder.Services.AddMessageHandler <DefaultStoreBackupHandler>();
            builder.Services.AddMessageHandler <RetrieveBackupHandler>();
            builder.Services.AddSingleton <IRoutingStore, DefaultRoutingStore>();
            builder.Services.AddSingleton <IStorageService, DefaultStorageService>();
            builder.Services.AddSingleton <IAgent, T>();
            builder.Services.Configure(options);
            builder.Services.AddHostedService <MediatorProvisioningService>();
            builder.Services.AddSingleton <MediatorDiscoveryMiddleware>();

            if (Environment.GetEnvironmentVariable("Agent_GenesisFilename") != null)
            {
                builder.Services.AddHostedService <PoolConfigurationService>();
            }

            return(builder);
        }
示例#2
0
        /// <summary>
        /// Registers and provisions an agent with custom implementation
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static AriesFrameworkBuilder RegisterAgent <T>(
            this AriesFrameworkBuilder builder,
            Action <AgentOptions> options)
            where T : class, IAgent
        {
            builder.AddAgentProvider();
            builder.Services.AddDefaultMessageHandlers();
            builder.Services.AddSingleton <IAgent, T>();
            builder.Services.Configure(options);
            builder.Services.AddHostedService <DefaultProvisioningHostedService>();
            builder.Services.AddHostedService <PoolConfigurationService>();

            return(builder);
        }
示例#3
0
        /// <summary>
        /// Registers and provisions an agent with custom implementation
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static AriesFrameworkBuilder RegisterMediatorAgent <T>(
            this AriesFrameworkBuilder builder,
            Action <AgentOptions> options)
            where T : class, IAgent
        {
            builder.AddAgentProvider();
            builder.Services.AddDefaultMessageHandlers();
            builder.Services.AddMessageHandler <MediatorForwardHandler>();
            builder.Services.AddMessageHandler <RoutingInboxHandler>();
            builder.Services.AddSingleton <IRoutingStore, DefaultRoutingStore>();
            builder.Services.AddSingleton <IAgent, T>();
            builder.Services.Configure(options);
            builder.Services.AddHostedService <MediatorProvisioningService>();
            builder.Services.AddSingleton <MediatorDiscoveryMiddleware>();

            return(builder);
        }
        /// <summary>
        /// Registers and provisions an agent with custom implementation
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static AriesFrameworkBuilder RegisterEdgeAgent <T>(
            this AriesFrameworkBuilder builder,
            Action <AgentOptions> options,
            bool delayProvisioning = false)
            where T : class, IAgent
        {
            builder.AddAgentProvider();
            builder.Services.AddDefaultMessageHandlers();
            builder.Services.AddSingleton <IAgent, T>();
            builder.Services.Configure(options);
            builder.Services.AddSingleton <IEdgeClientService, EdgeClientService>();
            builder.Services.AddSingleton <IEdgeProvisioningService, EdgeProvisioningService>();
            builder.Services.AddExtendedConnectionService <EdgeConnectionService>();
            if (!delayProvisioning)
            {
                builder.Services.AddHostedService <EdgeProvisioningService>();
            }

            return(builder);
        }