Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka CoordinatorRuntime ScheduleReadOperation

From Leeroopedia


Knowledge Sources
Domains Distributed_Systems, State_Management
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for scheduling coordinator state queries provided by the CoordinatorRuntime framework.

Description

The scheduleReadOperation method creates a CoordinatorReadEvent and enqueues it for processing. The event executes the read operation lambda against the coordinator's committed state and completes the returned future immediately with the result.

Usage

Called by coordinator service implementations for read-only queries like DescribeGroup, ListGroups, etc.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntime.java
  • Lines: L2207-2217

Signature

public <T> CompletableFuture<T> scheduleReadOperation(
    String name,
    TopicPartition tp,
    CoordinatorReadOperation<S, T> op
)

Import

import org.apache.kafka.coordinator.common.runtime.CoordinatorRuntime;
import org.apache.kafka.common.TopicPartition;
import java.util.concurrent.CompletableFuture;

I/O Contract

Inputs

Name Type Required Description
name String Yes Operation name for logging
tp TopicPartition Yes The coordinator's topic-partition
op CoordinatorReadOperation<S, T> Yes Lambda that reads from committed coordinator state

Outputs

Name Type Description
CompletableFuture<T> future Completes immediately with query result

Usage Examples

CompletableFuture<GroupDescription> future = coordinatorRuntime.scheduleReadOperation(
    "DescribeGroup",
    new TopicPartition("__consumer_offsets", 0),
    (coordinator) -> coordinator.describeGroup("my-consumer-group")
);

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment