Exemple #1
0
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();

            context.Services.AddAbpDbContext <AppDbContext>(options =>
            {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
            });

            Configure <AbpDbContextOptions>(options =>
            {
                /* The main point to change your DBMS.
                 * See also VoucherManagementMigrationsDbContextFactory for EF Core tooling. */
                options.UseMySQL();
            });

            context.AddCapEventBus(capOptions =>
            {
                //capOptions.UseEntityFramework<AppDbContext>();
                capOptions.UseInMemoryStorage();
                capOptions.UseRabbitMQ("localhost"); //UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                capOptions.UseDashboard();           //CAP2.X版本以后官方提供了Dashboard页面访问。
            });
            ConfigureSwaggerServices(context, configuration);

            ConfigureWorkflowcore(context);
        }
Exemple #2
0
        /// <summary>
        ///     配置 CAP
        /// </summary>
        /// <param name="context"></param>
        /// <param name="configuration"></param>
        /// <param name="hostingEnvironment"></param>
        private void ConfigureCAP(ServiceConfigurationContext context,
                                  IConfiguration configuration,
                                  IWebHostEnvironment hostingEnvironment) =>
        context.AddCapEventBus(capAction: capOptions =>
        {
            capOptions.UseDashboard();
            capOptions.UseEntityFramework <LedgerManagementDbContext>();
            capOptions.UseRabbitMQ(configure: _ =>
            {
                _.HostName = configuration[key: "Cap:RabbitMQ:HostName"];
                _.UserName = configuration[key: "Cap:RabbitMQ:UserName"];
                _.Password = configuration[key: "Cap:RabbitMQ:Password"];

                if (hostingEnvironment.IsProduction() &&
                    configuration.GetValue(key: "Cap:Aliyun:Enable", defaultValue: false))
                {
                    _.ConnectionFactoryOptions = options =>
                    {
                        options.VirtualHost    = configuration[key: "Cap:Aliyun:VirtualHost"];
                        options.AuthMechanisms = new List <IAuthMechanismFactory> {
                            new AliyunMechanismFactory()
                        };
                    };
                }
            });
        });
Exemple #3
0
        private void ConfigureCapEventBus(ServiceConfigurationContext context, IConfiguration configuration)
        {
            context.AddCapEventBus(capOptions =>
            {
                capOptions.DefaultGroup            = "AbpLoan";
                capOptions.FailedThresholdCallback = (failed) =>
                {
                    switch (failed.MessageType)
                    {
                    case DotNetCore.CAP.Messages.MessageType.Publish:
                        System.Diagnostics.Debug.WriteLine(failed.Message);
                        break;

                    case DotNetCore.CAP.Messages.MessageType.Subscribe:
                        System.Diagnostics.Debug.WriteLine(failed.Message);
                        break;

                    default:
                        break;
                    }
                };
                capOptions.UseEntityFramework <LoanDbContext>();
                capOptions.UseRabbitMQ(x =>
                {
                    x.HostName    = configuration["CAP:RabbitMQ:Host"];
                    x.UserName    = configuration["CAP:RabbitMQ:User"];
                    x.Password    = configuration["CAP:RabbitMQ:Password"];
                    x.VirtualHost = configuration["CAP:RabbitMQ:VirtualHost"];
                });
                capOptions.UseDashboard();
            });
        }
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();

            context.Services.AddAbpDbContext <AppDbContext>(options =>
            {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
            });

            Configure <AbpDbContextOptions>(options =>
            {
                /* The main point to change your DBMS.
                 * See also VoucherManagementMigrationsDbContextFactory for EF Core tooling. */
                options.UseSqlServer();
            });

            context.AddCapEventBus(capOptions =>
            {
                // If you are using EF, you need to add the configuration:
                // Options, Notice: You don't need to config x.UseSqlServer(""") again! CAP can autodiscovery.
                capOptions.UseEntityFramework <AppDbContext>();
                capOptions.UseRabbitMQ("localhost"); //UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                capOptions.UseDashboard();           //CAP2.X版本以后官方提供了Dashboard页面访问。
            });

            ConfigureSwaggerServices(context, configuration);
        }
Exemple #5
0
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.AddAbpDbContext <BookStoreThemeDbContext>(options =>
            {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
            });

            Configure <AbpDbContextOptions>(options =>
            {
                /* The main point to change your DBMS.
                 * See also BookStoreThemeMigrationsDbContextFactory for EF Core tooling. */
                options.UseSqlServer();
            });

            var configuration = context.Services.GetConfiguration();

            //Configure<AbpRabbitMqEventBusOptions>(configuration.GetSection("RabbitMQ:EventBus"));

            //Configure<RabbitMQOptions>(configuration.GetSection("CAP:RabbitMQ"));

            context.AddCapEventBus(capOptions =>
            {
                capOptions.UseEntityFramework <BookStoreThemeDbContext>();
                capOptions.UseRabbitMQ(o => {
                    o.HostName = configuration.GetSection("CAP:RabbitMQ:HostName")?.Value;//UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                    o.ConnectionFactoryOptions = opt => {
                        //configuration.GetSection("CAP:RabbitMQ:ConnectionFactoryOptions");
                        //rabbitmq client ConnectionFactory config
                    };
                });
                capOptions.UseDashboard();//CAP2.X版本以后官方提供了Dashboard页面访问。
            });
        }
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();

            context.AddCapEventBus(capOptions =>
            {
                capOptions.UsePostgreSql("");
                capOptions.UseRabbitMQ("localhost"); //UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                capOptions.UseDashboard();           //CAP2.X版本以后官方提供了Dashboard页面访问。
            });
            ConfigureSwaggerServices(context, configuration);

            ConfigureWorkflowcore(context);
        }
Exemple #7
0
        private void ConfigureCAP(ServiceConfigurationContext context, IConfiguration configuration)
        {
            context.AddCapEventBus(capOptions =>
            {
                capOptions.UseEntityFramework <ApiGatewayDbContext>();
                capOptions.UseRabbitMQ(cfg =>
                {
                    cfg.HostName     = configuration.GetValue <string>("CAP:RabbitMQ:Connect:Host");
                    cfg.VirtualHost  = configuration.GetValue <string>("CAP:RabbitMQ:Connect:VirtualHost");
                    cfg.Port         = configuration.GetValue <int>("CAP:RabbitMQ:Connect:Port");
                    cfg.UserName     = configuration.GetValue <string>("CAP:RabbitMQ:Connect:UserName");
                    cfg.Password     = configuration.GetValue <string>("CAP:RabbitMQ:Connect:Password");
                    cfg.ExchangeName = configuration.GetValue <string>("CAP:RabbitMQ:Connect:ExchangeName");
                });

                capOptions.FailedRetryCount = 5;//UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                // capOptions.UseDashboard();//CAP2.X版本以后官方提供了Dashboard页面访问。
            });
        }
Exemple #8
0
        private void ConfigureCAP(ServiceConfigurationContext context, IConfiguration configuration)
        {
            context.AddCapEventBus(capOptions =>
            {
                capOptions.UseInMemoryStorage();
                capOptions.UseRabbitMQ(cfg =>
                {
                    cfg.HostName    = "localhost"; configuration.GetValue <string>("CAP:RabbitMQ:Connect:Host");
                    cfg.VirtualHost = "/";     //configuration.GetValue<string>("CAP:RabbitMQ:Connect:VirtualHost");
                    cfg.Port        = 15672;   //configuration.GetValue<int>("CAP:RabbitMQ:Connect:Port");
                    cfg.UserName    = "******"; //configuration.GetValue<string>("CAP:RabbitMQ:Connect:UserName");
                    cfg.Password    = "******"; configuration.GetValue <string>("CAP:RabbitMQ:Connect:Password");
                    // cfg.ExchangeName = configuration.GetValue<string>("CAP:RabbitMQ:Connect:ExchangeName");
                });

                capOptions.FailedRetryCount = 5;//UseRabbitMQ 服务器地址配置,支持配置IP地址和密码
                // capOptions.UseDashboard();//CAP2.X版本以后官方提供了Dashboard页面访问。
            });
        }
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.TryAddSingleton <IHttpContextAccessor>();
            Configure <AbpAutoMapperOptions>(options =>
            {
                options.AddMaps <HelloApplicationModule>();
            });

            //Configure<AbpRabbitMqEventBusOptions>(options =>
            //{
            //    options.ClientName = "hello-abp";
            //    options.ExchangeName = "hello-exchange";
            //    options.ConnectionName = "Hello";
            //});

            Configure <AbpBackgroundJobWorkerOptions>(options =>
            {
                options.DefaultTimeout           = 3600;
                options.JobPollPeriod            = 2;
                options.MaxJobFetchCount         = 8;
                options.DefaultFirstWaitDuration = 3600;
                options.DefaultWaitFactor        = Math.E;
            });
            Configure <AbpBackgroundJobOptions>(options =>
            {
                options.IsJobExecutionEnabled = true;
            });
            Configure <AbpUnitOfWorkOptions>((options) =>
            {
                options.IsolationLevel  = IsolationLevel.ReadUncommitted;
                options.IsTransactional = false;
            });
            Configure <AbpClockOptions>(options =>
            {
                options.Kind = DateTimeKind.Local;
            });

            context.AddCapEventBus(capOptions =>
            {
                // capOptions.UseSqlServer();
                capOptions.DefaultGroup            = "Abp.VNext.Hello.Cap-Queue";
                capOptions.FailedThresholdCallback = (failed) =>
                {
                    switch (failed.MessageType)
                    {
                    case DotNetCore.CAP.Messages.MessageType.Publish:
                        System.Diagnostics.Debug.WriteLine(failed.Message);
                        break;

                    case DotNetCore.CAP.Messages.MessageType.Subscribe:
                        System.Diagnostics.Debug.WriteLine(failed.Message);
                        break;

                    default:
                        break;
                    }
                };
                capOptions.UseInMemoryStorage();
                capOptions.UseRabbitMQ(x =>
                {
                    x.HostName    = "47.98.226.195";
                    x.UserName    = "******";
                    x.Password    = "******";
                    x.VirtualHost = "/";
                });                        // 服务器地址配置,支持配置IP地址和密码
                capOptions.UseDashboard(); //CAP2.X版本以后官方提供了Dashboard页面访问。
            });
        }