public async Task Publish(PubSubChannel channel, PubSubMessage message)
        {
            var redisChannel = new RedisChannel(channel.Channel, RedisChannel.PatternMode.Auto);
            var redisMessage = new RedisValue(message.Content);

            await this.pubsub.PublishAsync(redisChannel, redisMessage);
        }
        private void OnMessageReceived(PubSubChannel channel, PubSubMessage message)
        {
            if (this.Status != WorkflowStatus.Running)
            {
                return;
            }

            Console.WriteLine($"[WorkflowBase] {this.currentTask.Name} received an event with message " + message.Content);

            switch (message.Content)
            {
            case "Succeeded":
            {
                taskCompletionSource.SetResult(TaskStatus.Succeeded);

                break;
            }

            case "Failed":
            {
                taskCompletionSource.SetResult(TaskStatus.Failed);
                break;
            }

            case "Cancelled":
            {
                taskCompletionSource.SetResult(TaskStatus.Cancelled);
                break;
            }
            }
        }
        public async Task Unsubscribe(PubSubChannel channel, Action <PubSubChannel, PubSubMessage> handler)
        {
            var redisChannel = new RedisChannel(channel.Channel, RedisChannel.PatternMode.Auto);
            var redisHandler = new Action <RedisChannel, RedisValue>((c, v) =>
            {
                var pubSubChannel = new PubSubChannel(c.ToString());
                var pubSubMessage = new PubSubMessage(v.ToString());

                handler(pubSubChannel, pubSubMessage);
            });

            await this.pubsub.UnsubscribeAsync(redisChannel, redisHandler);
        }