public WorkerRecycler(string taskHub, ConnectionMultiplexer connection) { this.taskHub = taskHub; this.redisConnection = connection; this.workerSetKey = RedisKeyNameResolver.GetWorkerSetKey(this.taskHub); this.incomingActivityQueueKey = RedisKeyNameResolver.GetTaskActivityIncomingQueueKey(this.taskHub); this.logger = new RedisLogger(this.redisConnection, this.taskHub); }
public ActivityTaskHandler(string taskHub, string workerId, ConnectionMultiplexer connection) { this.workerId = workerId; this.taskHub = taskHub; this.taskLocks = new ConcurrentDictionary <int, SemaphoreSlim>(); this.redisConnection = connection; this.processingTaskQueueKey = RedisKeyNameResolver.GetTaskActivityProcessingQueueKey(this.taskHub, this.workerId); this.incomingTaskQueueKey = RedisKeyNameResolver.GetTaskActivityIncomingQueueKey(this.taskHub); this.redisLogger = new RedisLogger(this.redisConnection, this.taskHub); }
private OrchestrationSessionPartitionHandler(ConnectionMultiplexer redisConnection, string taskHub, string partition = "singleton") { this.taskHub = taskHub; this.redisConnection = redisConnection; this.partition = partition; this.activeOrchestrationLocks = new ConcurrentDictionary <string, SemaphoreSlim>(); this.partitionControlQueueKey = RedisKeyNameResolver.GetPartitionControlQueueKey(this.taskHub, this.partition); this.partitionControlQueueNotificationChannelKey = RedisKeyNameResolver.GetPartitionControlNotificationChannelKey(this.taskHub, this.partition); this.currentOrchestrationsSetKey = RedisKeyNameResolver.GetOrchestrationsSetKey(this.taskHub, this.partition); this.logger = new RedisLogger(redisConnection, taskHub); }
/// <inheritdoc /> public async Task StartAsync() { await this.startLock.WaitAsync(); if (this.workerGuid == null) { this.redisConnection = await ConnectionMultiplexer.ConnectAsync(this.settings.RedisConnectionString); this.workerRecycler = new WorkerRecycler(this.settings.TaskHubName, this.redisConnection); await this.workerRecycler.CleanupWorkersAsync(); this.workerGuid = Guid.NewGuid().ToString(); RegisterWorker(); this.partitionOrchestrationManager = await OrchestrationSessionPartitionHandler.GetOrchestrationSessionManagerAsync(this.redisConnection, this.settings.TaskHubName); this.activityTaskManager = new ActivityTaskHandler(taskHub: this.settings.TaskHubName, workerId: this.workerGuid, connection: this.redisConnection); this.logger = new RedisLogger(this.redisConnection, this.settings.TaskHubName); } this.startLock.Release(); }