コード例 #1
0
        public static WorkflowOptions UseRabbitMQ(this WorkflowOptions options, RabbitMqConnectionFactory rabbitMqConnectionFactory)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (rabbitMqConnectionFactory == null)
            {
                throw new ArgumentNullException(nameof(rabbitMqConnectionFactory));
            }

            options.Services.AddSingleton(rabbitMqConnectionFactory);
            options.Services.TryAddSingleton <IRabbitMqQueueNameProvider, DefaultRabbitMqQueueNameProvider>();
            options.UseQueueProvider(RabbitMqQueueProviderFactory);

            return(options);
        }
コード例 #2
0
        /// <summary>
        ///     Use SQL Server as a queue provider
        /// </summary>
        /// <param name="options"></param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        public static WorkflowOptions UseSqlServerBroker(this WorkflowOptions options, string connectionString, bool canCreateDb, bool canMigrateDb)
        {
            options.Services.AddTransient <IQueueConfigProvider, QueueConfigProvider>();
            options.Services.AddTransient <ISqlCommandExecutor, SqlCommandExecutor>();
            options.Services.AddTransient <ISqlServerQueueProviderMigrator>(sp => new SqlServerQueueProviderMigrator(connectionString, sp.GetService <IQueueConfigProvider>(), sp.GetService <ISqlCommandExecutor>()));

            var sqlOptions = new SqlServerQueueProviderOptions()
            {
                ConnectionString = connectionString,
                CanCreateDb      = canCreateDb,
                CanMigrateDb     = canMigrateDb
            };

            options.UseQueueProvider(sp =>
            {
                return(new SqlServerQueueProvider(sqlOptions, sp.GetService <IQueueConfigProvider>(), sp.GetService <ISqlServerQueueProviderMigrator>(), sp.GetService <ISqlCommandExecutor>()));
            });

            return(options);
        }
コード例 #3
0
 public static WorkflowOptions UseRedisQueues(this WorkflowOptions options, string connectionString, string prefix)
 {
     options.UseQueueProvider(sp => new RedisQueueProvider(connectionString, prefix, sp.GetService <ILoggerFactory>()));
     return(options);
 }
コード例 #4
0
 public static WorkflowOptions UseAzureSynchronization(this WorkflowOptions options, string connectionString)
 {
     options.UseQueueProvider(sp => new AzureStorageQueueProvider(connectionString, sp.GetService <ILoggerFactory>()));
     options.UseDistributedLockManager(sp => new AzureLockManager(connectionString, sp.GetService <ILoggerFactory>()));
     return(options);
 }
コード例 #5
0
 public static WorkflowOptions UseAwsSimpleQueueService(this WorkflowOptions options, AWSCredentials credentials, AmazonSQSConfig config, string queuesPrefix = "workflowcore")
 {
     options.UseQueueProvider(sp => new SQSQueueProvider(credentials, config, sp.GetService <ILoggerFactory>(), queuesPrefix));
     return(options);
 }
コード例 #6
0
 public static WorkflowOptions UseRabbitMQ(this WorkflowOptions options, IConnectionFactory connectionFactory)
 {
     options.UseQueueProvider(sp => new RabbitMQProvider(connectionFactory));
     return(options);
 }
コード例 #7
0
 public static WorkflowOptions UseZeroMQQueuing(this WorkflowOptions options, int port, IEnumerable <string> peers, bool canTakeWork = true)
 {
     options.UseQueueProvider(sp => new ZeroMQProvider(port, peers, canTakeWork, sp.GetService <ILoggerFactory>()));
     return(options);
 }
コード例 #8
0
 public static WorkflowOptions UseActiveMQ(this WorkflowOptions options, IConnectionFactory connectionFactory, string workflowQueueName = "wfc.workflow_queue",
                                           string eventQueueName = "wfc.event_queue")
 {
     options.UseQueueProvider(sp => new ActiveMQProvider(connectionFactory, workflowQueueName, eventQueueName));
     return(options);
 }