/// <summary>
        /// Configures manual subscription
        /// </summary>
        /// <param name="subscription"></param>
        protected void ConfigureManualSubscription(IManualSubscription subscription)
        {
            switch (subscription)
            {
            case Assignment assignment:
                ConsumerActor.Tell(new KafkaConsumerActorMetadata.Internal.Assign(assignment.TopicPartitions), SourceActor.Ref);
                TopicPartitions = TopicPartitions.Union(assignment.TopicPartitions);
                break;

            case AssignmentWithOffset assignmentWithOffset:
                ConsumerActor.Tell(new KafkaConsumerActorMetadata.Internal.AssignWithOffset(assignmentWithOffset.TopicPartitions), SourceActor.Ref);
                TopicPartitions = TopicPartitions.Union(assignmentWithOffset.TopicPartitions.Select(tp => tp.TopicPartition));
                break;
            }
        }
        /// <inheritdoc />
        protected override void ConfigureSubscription()
        {
            switch (_subscription)
            {
            case TopicSubscription topicSubscription:
                ConsumerActor.Tell(new KafkaConsumerActorMetadata.Internal.Subscribe(topicSubscription.Topics), SourceActor.Ref);
                break;

            case TopicSubscriptionPattern topicSubscriptionPattern:
                ConsumerActor.Tell(new KafkaConsumerActorMetadata.Internal.SubscribePattern(topicSubscriptionPattern.TopicPattern), SourceActor.Ref);
                break;

            case IManualSubscription manualSubscription:
                ConfigureManualSubscription(manualSubscription);
                break;

            default:
                throw new NotSupportedException();
            }
        }
        public override void PostStop()
        {
            ConsumerActor.Tell(KafkaConsumerActorMetadata.Internal.Stop.Instance, SourceActor.Ref);

            base.PostStop();
        }