Exemplo n.º 1
0
        /// <summary>
        ///     Handle new partition assignment
        /// </summary>
        /// <param name="partitions"></param>
        private IEnumerable <TopicPartitionOffset> HandleAssign(IEnumerable <TopicPartition> partitions)
        {
            Dbg($"New assignment: {string.Join(", ", partitions)}");
            if (currentAssignment != null)
            {
                Fatal($"Received new assignment {partitions} with already existing assignment in place: {currentAssignment}");
            }

            currentAssignment = new Dictionary <TopicPartition, AssignedPartition>();

            foreach (var p in partitions)
            {
                currentAssignment[p] = new AssignedPartition();
            }

            SendPartitions("partitions_assigned", partitions);

            return(partitions.Select(tp => new TopicPartitionOffset(tp, Offset.Unset)));
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Handle new partition assignment
        /// </summary>
        /// <param name="partitions"></param>
        private void HandleAssign(IEnumerable <TopicPartition> partitions)
        {
            Dbg($"New assignment: {string.Join(", ", partitions)}");
            if (currentAssignment != null)
            {
                Fatal($"Received new assignment {partitions} with already existing assignment in place: {currentAssignment}");
            }

            currentAssignment = new Dictionary <TopicPartition, AssignedPartition>();

            foreach (var p in partitions)
            {
                currentAssignment[p] = new AssignedPartition();
            }

            consumer.Assign(partitions);

            SendPartitions("partitions_assigned", partitions);
        }