Exemplo n.º 1
0
        void RebalanceCallback(IntPtr rk, ErrorCode err,
                               /* rd_kafka_topic_partition_list_t * */ IntPtr partitions,
                               IntPtr opaque)
        {
            var partitionList = SafeKafkaHandle.GetTopicPartitionOffsetList(partitions);

            if (err == ErrorCode._ASSIGN_PARTITIONS)
            {
                var handler = OnPartitionsAssigned;
                if (handler != null && handler.GetInvocationList().Length > 0)
                {
                    handler(this, partitionList);
                }
                else
                {
                    Assign(partitionList);
                }
            }
            if (err == ErrorCode._REVOKE_PARTITIONS)
            {
                var handler = OnPartitionsRevoked;
                if (handler != null && handler.GetInvocationList().Length > 0)
                {
                    handler(this, partitionList);
                }
                else
                {
                    Unassign();
                }
            }
        }
Exemplo n.º 2
0
 internal void CommitCallback(IntPtr rk,
                              ErrorCode err,
                              /* rd_kafka_topic_partition_list_t * */ IntPtr offsets,
                              IntPtr opaque)
 {
     OnOffsetCommit?.Invoke(this, new OffsetCommitArgs()
     {
         Error   = err,
         Offsets = SafeKafkaHandle.GetTopicPartitionOffsetList(offsets)
     });
 }