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); }
public RedisTransactionBuilder SendControlQueueMessage(TaskMessage message) { if (this.partition == null) { throw new ArgumentNullException($"Cannot call {nameof(SendControlQueueMessage)} without a partition set."); } string controlQueueKey = RedisKeyNameResolver.GetPartitionControlQueueKey(this.taskHub, this.partition); string controlQueueNotificationChannelKey = RedisKeyNameResolver.GetPartitionControlNotificationChannelKey(this.taskHub, this.partition); string messageJson = RedisSerializer.SerializeObject(message); this.transaction.ListLeftPushAsync(controlQueueKey, messageJson); this.transaction.PublishAsync(new RedisChannel(controlQueueNotificationChannelKey, RedisChannel.PatternMode.Literal), messageJson); return(this); }