示例#1
0
 public FetchedJob(DocumentDbStorage storage, Documents.Queue data)
 {
     this.storage = storage;
     Id           = data.Id;
     JobId        = data.JobId;
     Queue        = data.Name;
 }
        public static CosmosDbElsaBuilder AddCosmosDbProvider(
            this ElsaBuilder builder,
            string url,
            string authSecret,
            string database,
            string collection,
            DocumentDbStorageOptions options = null)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException(nameof(url));
            }
            if (string.IsNullOrEmpty(authSecret))
            {
                throw new ArgumentNullException(nameof(authSecret));
            }

            var storage = new DocumentDbStorage(url, authSecret, database, collection, options);

            builder.Services
            .AddSingleton(storage)
            .AddMapperProfile <NodaTimeProfile>(ServiceLifetime.Singleton)
            .AddMapperProfile <DocumentProfile>(ServiceLifetime.Singleton);

            return(new CosmosDbElsaBuilder(builder.Services));
        }
        public FetchedJob(DocumentDbStorage storage, Documents.Queue data)
        {
            this.storage = storage;
            this.data    = data;

            TimeSpan keepAliveInterval = TimeSpan.FromMinutes(5);

            timer = new Timer(KeepAliveJobCallback, data, keepAliveInterval, keepAliveInterval);
        }
示例#4
0
        public CosmosDbWorkflowDefinitionStore(DocumentDbStorage storage)
        {
            this.storage = storage;
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <InstantProfile>();
                cfg.AddProfile <DocumentProfile>();
            });

            mapper = configuration.CreateMapper();
        }
示例#5
0
        /// <summary>
        /// Enables to attach Azure DocumentDb to Hangfire
        /// </summary>
        /// <param name="configuration">The IGlobalConfiguration object</param>
        /// <param name="url">The url string to DocumentDb Database</param>
        /// <param name="authSecret">The secret key for the DocumentDb Database</param>
        /// <param name="database">The name of the database to connect with</param>
        /// <param name="collection">The name of the collection on the database</param>
        /// <param name="options">The DocumentDbStorage object to override any of the options</param>
        /// <returns></returns>
        public static IGlobalConfiguration <DocumentDbStorage> UseAzureDocumentDbStorage(this IGlobalConfiguration configuration, string url, string authSecret, string database, string collection, DocumentDbStorageOptions options = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException(nameof(url));
            }
            if (string.IsNullOrEmpty(authSecret))
            {
                throw new ArgumentNullException(nameof(authSecret));
            }

            DocumentDbStorage storage = new DocumentDbStorage(url, authSecret, database, collection, options);

            return(configuration.UseStorage(storage));
        }
示例#6
0
 public JobQueue(DocumentDbStorage storage)
 {
     this.storage       = storage;
     defaultLockTimeout = TimeSpan.FromSeconds(30) + storage.Options.QueuePollInterval;
 }
 public JobQueueProvider(DocumentDbStorage storage)
 {
     queue           = new JobQueue(storage);
     monitoringQueue = new JobQueueMonitoringApi(storage);
 }
示例#8
0
 public JobQueueMonitoringApi(DocumentDbStorage storage) => this.storage = storage;
示例#9
0
 public CosmosDbWorkflowDefinitionStore(DocumentDbStorage storage, IMapper mapper)
 {
     this.storage = storage;
     this.mapper  = mapper;
 }
 public CosmosDbWorkflowInstanceStore(DocumentDbStorage storage, IMapper mapper)
 {
     this.storage = storage;
     this.mapper  = mapper;
 }
示例#11
0
 public JobQueue(DocumentDbStorage storage) => this.storage = storage;