Пример #1
0
        public static JobsBuilder WithInMemoryBroker(this JobsBuilder jobs, InMemoryMessages messages = null)
        {
            jobs.RegisterInstance(messages ?? new InMemoryMessages());
            jobs.RegisterSingleton <IMessagePublisher, InMemoryMessagePublisher>();
            jobs.RegisterSingleton <IMessageConsumer, InMemoryMessageConsumer>();

            return(jobs);
        }
Пример #2
0
        public static JobsBuilder WithSqlServerBroker <TDbContext>(this JobsBuilder builder) where TDbContext : DbContext
        {
            builder.RegisterScoped <IMessagePublisher, SqlServerMessagePublisher <TDbContext> >();
            builder.RegisterSingleton <IMessageConsumer, SqlServerMessageConsumer <TDbContext> >();
            builder.RegisterSingleton <ISqlDialect, SqlDialects.SqlServerDialect>();

            return(builder);
        }
Пример #3
0
        public static JobsBuilder WithRabbitMqBroker(this JobsBuilder builder, Action <RabbitMqSettings> configureAction = null)
        {
            var rabbitMqSettings = new RabbitMqSettings();

            configureAction?.Invoke(rabbitMqSettings);

            builder.RegisterInstance(rabbitMqSettings);

            builder.RegisterSingleton <IMessagePublisher, RabbitMqMessagePublisher>();
            builder.RegisterSingleton <IMessageConsumer, RabbitMqMessageConsumer>();

            return(builder);
        }
Пример #4
0
 public static JobsBuilder WithLog4Net(this JobsBuilder builder)
 {
     builder.RegisterSingleton <IJobLoggerFactory, LoggerWrapperFactory>();
     return(builder);
 }