Open-source Apache Kafka client driver written in pure MoonBit
Dependencies
Status: targeted for 0.2.0 — the transport + data-plane feature set is implemented and covered by a 200+ test suite (unit, mock-broker, golden fixtures) plus an optional real-cluster integration harness. The API may still change before 1.0.
moon add daqing/moonkafka///|
async fn main {
// Produce
let producer = @moonkafka.Producer::connect(
host="127.0.0.1",
port=9092,
topic="events",
)
defer producer.close()
let offset = producer.send(
key=@utf8.encode("k1"),
value=@utf8.encode("hello"),
)
println("produced at offset \{offset}")
// Consume
let consumer = @moonkafka.Consumer::connect(
host="127.0.0.1",
port=9092,
topic="events",
start_from=@moonkafka.StartFrom::Earliest,
)
defer consumer.close()
for ;; {
for record in consumer.poll() {
println("offset=\{record.offset} value=\{record.value}")
}
}
}moon run cmd/main -- consume events [host] [port]moon run cmd/main -- produce events "hello" [key] [host] [port]moon test # unit + mock-broker (fake broker) suite
make fmt # format code
make info # regenerate package interfaces (.mbti)
make integration # Kafka 4.3 (docker or podman) + real-client smoke test
make bench # produce/consume throughput (needs a broker)
make docker-up # start a KRaft cluster (make docker-up MULTI=1 for 3 nodes)type MetricsProvider = () -> Bytespub(all) suberror BrokerError {
BrokerError(Int, String)
}pub(all) suberror SaslError {
SaslError(String)
}pub(all) suberror TransportError {
ConnectionClosed(String)
RequestTimeout(String)
}pub(all) struct AclBinding {
resource_type : Int
resource_name : String
pattern_type : Int
principal : String
host : String
operation : Int
permission_type : Int
} derive(Debug)pub(all) struct AclCreation {
resource_type : Int
resource_name : String
pattern_type : Int
principal : String
host : String
operation : Int
permission_type : Int
} derive(Debug)pub(all) struct AclDescription {
principal : String
host : String
operation : Int
permission_type : Int
} derive(Debug)pub(all) struct AclFilter {
resource_type : Int
resource_name : String?
pattern_type : Int
principal : String?
host : String?
operation : Int
permission_type : Int
} derive(Debug)pub struct Admin {
request_timeout_ms : Int
admin_retries : Int
retry_backoff_ms : Int
retry_backoff_max_ms : Int
closed : Bool
// private fields
}async fn Admin::alter_client_quotas(self : Admin, entries : Array[ClientQuotaAlteration], validate_only? : Bool) -> Array[AlterClientQuotasResult]async fn Admin::alter_configs(self : Admin, resources : Array[SettableConfigResource], validate_only? : Bool) -> Array[AlterConfigsResult]async fn Admin::alter_partition_reassignments(self : Admin, topics : Array[ReassignableTopic], allow_replication_factor_change? : Bool) -> AdminReassignmentResultasync fn Admin::alter_share_group_offsets(self : Admin, group_id : String, topics : Array[ShareOffsetAlterTopic]) -> ShareOffsetAlterResultasync fn Admin::alter_user_scram(self : Admin, deletions : Array[ScramCredentialDeletion], upsertions : Array[ScramCredentialUpsertion]) -> Array[AlterUserScramResult]async fn Admin::create_acls(self : Admin, creations : Array[AclCreation]) -> Array[CreateAclsResult]async fn Admin::create_partitions(self : Admin, topics : Array[CreatePartitionsSpec], validate_only? : Bool) -> Array[CreatePartitionsResult]async fn Admin::create_topics(self : Admin, topics : Array[CreatableTopic], validate_only? : Bool) -> Array[CreateTopicsResult]async fn Admin::delete_share_group_offsets(self : Admin, group_id : String, topics : Array[String]) -> ShareOffsetDeleteResultasync fn Admin::describe_client_quotas(self : Admin, filter : ClientQuotaFilter) -> DescribeClientQuotasResultasync fn Admin::describe_cluster(self : Admin, include_authorized_operations? : Bool, include_fenced_brokers? : Bool) -> AdminClusterDescriptionasync fn Admin::describe_configs(self : Admin, resources : Array[ConfigResourceKey]) -> Array[AdminConfigsResult]async fn Admin::describe_consumer_groups(self : Admin, group_ids : Array[String], include_authorized_operations? : Bool) -> Array[AdminConsumerGroupDescription]async fn Admin::describe_groups(self : Admin, groups : Array[String], include_authorized_operations? : Bool) -> Array[AdminGroupDescription]async fn Admin::describe_log_dirs(self : Admin, topics? : Array[(String, Array[Int])]?) -> AdminLogDirsasync fn Admin::describe_quorum(self : Admin, topic? : String, partition? : Int) -> AdminQuorumDescriptionasync fn Admin::describe_share_group_offsets(self : Admin, group_id : String, topics : Array[ShareOffsetDescribeTopic]) -> Array[ShareOffsetDescribeGroupResult]async fn Admin::describe_topic_partitions(self : Admin, topics : Array[String]) -> Array[AdminTopicDescription]async fn Admin::describe_transactions(self : Admin, transactional_ids : Array[String]) -> Array[AdminDescribeTransaction]async fn Admin::describe_user_scram(self : Admin, users : Array[String]?) -> DescribeUserScramResultasync fn Admin::elect_leaders(self : Admin, election_type : Int, topic_partitions? : Array[(String, Array[Int])]?) -> AdminElectionResultasync fn Admin::incremental_alter_configs(self : Admin, resources : Array[AlterableConfigResource], validate_only? : Bool) -> Array[AlterConfigsResult]async fn Admin::list_config_resources(self : Admin, resource_types? : Array[Int]) -> ListConfigResourcesResultasync fn Admin::list_groups(self : Admin, states_filter? : Array[String], types_filter? : Array[String]) -> AdminListGroupsResultasync fn Admin::list_partition_reassignments(self : Admin, topics? : Array[(String, Array[Int])]?) -> AdminOngoingReassignmentsasync fn Admin::list_transactions(self : Admin, state_filters? : Array[String], producer_id_filters? : Array[Int64], duration_filter? : Int64, transactional_id_pattern? : String?) -> AdminListTransactionsResultasync fn Admin::offset_delete(self : Admin, group_id : String, topics : Array[(String, Array[Int])]) -> OffsetDeleteResultasync fn Admin::update_features(self : Admin, updates : Array[FeatureUpdate], validate_only? : Bool) -> AdminUpdateFeaturesResultpub struct AdminActiveProducer {
producer_id : Int64
producer_epoch : Int
last_sequence : Int
last_timestamp : Int64
coordinator_epoch : Int
current_txn_start_offset : Int64
} derive(Debug)pub(all) struct AdminClusterBroker {
node_id : Int
host : String
port : Int
rack : String?
is_fenced : Bool
} derive(Debug)pub struct AdminClusterDescription {
error_code : Int
error_message : String?
endpoint_type : Int
cluster_id : String?
controller_id : Int
brokers : Array[AdminClusterBroker]
cluster_authorized_operations : Int
} derive(Debug)fn AdminConfig::new(bootstrap_servers : Array[String], request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, metadata_max_age_ms? : Int, admin_retries? : Int) -> AdminConfig raisepub struct AdminConfigsResult {
error_code : Int
error_message : String?
resource_type : Int
resource_name : String
configs : Array[AdminConfigEntry]
} derive(Debug)pub struct AdminConsumerGroupDescription {
error_code : Int
error_message : String?
group_id : String
group_state : String
group_epoch : Int
assignment_epoch : Int
assignor_name : String
members : Array[AdminConsumerGroupMember]
authorized_operations : Int?
} derive(Debug)pub struct AdminConsumerGroupMember {
member_id : String
instance_id : String?
rack_id : String?
member_epoch : Int
client_id : String
client_host : String
subscribed_topic_names : Array[String]
subscribed_topic_regex : String?
assignment : Array[AdminAssignedTopicPartitions]
target_assignment : Array[AdminAssignedTopicPartitions]
member_type : Int
} derive(Debug)pub struct AdminDescribeProducerPartition {
partition_index : Int
error_code : Int
error_message : String?
active_producers : Array[AdminActiveProducer]
} derive(Debug)pub struct AdminDescribeProducersTopic {
name : String
partitions : Array[AdminDescribeProducerPartition]
} derive(Debug)pub struct AdminDescribeTransaction {
error_code : Int
transactional_id : String
transaction_state : String
transaction_timeout_ms : Int
transaction_start_time_ms : Int64
producer_id : Int64
producer_epoch : Int
topics : Array[AdminTransactionTopic]
} derive(Debug)pub struct AdminElectionResult {
error_code : Int
results : Array[ElectLeadersTopicResult]
} derive(Debug)pub struct AdminGroupDescription {
error_code : Int
error_message : String?
group_id : String
group_state : String
protocol_type : String
protocol_data : String
members : Array[AdminGroupMember]
authorized_operations : Int?
} derive(Debug)pub struct AdminGroupMember {
member_id : String
group_instance_id : String?
client_id : String
client_host : String
member_metadata : Bytes
member_assignment : Bytes
} derive(Debug)pub struct AdminListTransactionsResult {
error_code : Int
unknown_state_filters : Array[String]
transactions : Array[AdminListedTransaction]
} derive(Debug)pub struct AdminListedGroup {
group_id : String
protocol_type : String
group_state : String
group_type : String
} derive(Debug)pub struct AdminListedTransaction {
transactional_id : String
producer_id : Int64
transaction_state : String
} derive(Debug)pub struct AdminOngoingReassignments {
error_code : Int
error_message : String?
topics : Array[(String, Array[OngoingPartitionReassignment])]
} derive(Debug)pub struct AdminQuorumDescription {
error_code : Int
error_message : String?
topics : Array[QuorumTopicState]
nodes : Array[QuorumNode]
} derive(Debug)pub struct AdminReassignmentResult {
error_code : Int
error_message : String?
responses : Array[(String, Array[ReassignablePartitionResponse])]
} derive(Debug)pub struct AdminTopicDescription {
name : String
error_code : Int
topic_id : Uuid
partitions : Array[PartitionInfo]
} derive(Debug)pub struct AlterClientQuotasResult {
error_code : Int
error_message : String?
entity : Array[QuotaEntity]
} derive(Debug)pub struct AlterConfigsResult {
error_code : Int
error_message : String?
resource_type : Int
resource_name : String
} derive(Debug)pub struct AlterUserScramResult {
user : String
error_code : Int
error_message : String?
} derive(Debug)pub(all) struct AlterableConfigResource {
resource_type : Int
resource_name : String
configs : Array[AlterableConfig]
} derive(Debug)pub struct BrokerConnection {
tcp : Tcp
stream : BrokerStream
client_id : String
write_lock : Mutex
read_lock : Mutex
responses : Map[Int, Bytes]
correlation_id : Int
closed : Bool
in_flight : Semaphore
throttled_until_ms : Int64
throttle_total_ms : Int64
versions : BrokerVersions?
}async fn BrokerConnection::add_offsets_to_txn(self : BrokerConnection, transactional_id : String, producer_id : Int64, producer_epoch : Int, group_id : String, timeout_ms? : Int) -> Intasync fn BrokerConnection::add_partitions_to_txn(self : BrokerConnection, transactional_id : String, producer_id : Int64, producer_epoch : Int, topics : Array[(String, Array[Int])], timeout_ms? : Int) -> Array[TxnPartitionResult]async fn BrokerConnection::alter_client_quotas(self : BrokerConnection, entries : Array[ClientQuotaAlteration], validate_only? : Bool, timeout_ms? : Int) -> Array[AlterClientQuotasResult]async fn BrokerConnection::alter_configs(self : BrokerConnection, resources : Array[SettableConfigResource], timeout_ms? : Int, validate_only? : Bool) -> Array[AlterConfigsResult]async fn BrokerConnection::alter_partition_reassignments(self : BrokerConnection, topics : Array[ReassignableTopic], timeout_ms? : Int, allow_replication_factor_change? : Bool) -> AdminReassignmentResultasync fn BrokerConnection::alter_share_group_offsets(self : BrokerConnection, group_id : String, topics : Array[ShareOffsetAlterTopic], timeout_ms? : Int) -> ShareOffsetAlterResultasync fn BrokerConnection::alter_user_scram(self : BrokerConnection, deletions : Array[ScramCredentialDeletion], upsertions : Array[ScramCredentialUpsertion], timeout_ms? : Int) -> Array[AlterUserScramResult]async fn BrokerConnection::authenticate(self : BrokerConnection, sasl : SaslConfig, timeout_ms? : Int) -> Unitasync fn BrokerConnection::connect(host : String, port : Int, client_id? : String, max_in_flight? : Int, timeout_ms? : Int, tls? : TlsClientOptions?) -> BrokerConnectionasync fn BrokerConnection::consumer_group_heartbeat(self : BrokerConnection, group_id : String, member_id : String, member_epoch : Int, instance_id? : String?, rebalance_timeout_ms? : Int, subscribed_topic_names? : Array[String]?, subscribed_topic_regex? : String?, server_assignor? : String?, timeout_ms? : Int) -> ConsumerGroupHeartbeatResultasync fn BrokerConnection::create_acls(self : BrokerConnection, creations : Array[AclCreation], timeout_ms? : Int) -> Array[CreateAclsResult]async fn BrokerConnection::create_partitions(self : BrokerConnection, topics : Array[CreatePartitionsSpec], timeout_ms : Int, validate_only? : Bool) -> Array[CreatePartitionsResult]async fn BrokerConnection::create_topics(self : BrokerConnection, topics : Array[CreatableTopic], timeout_ms : Int, validate_only? : Bool) -> Array[CreateTopicsResult]async fn BrokerConnection::delete_acls(self : BrokerConnection, filters : Array[AclFilter], timeout_ms? : Int) -> Array[DeleteAclsFilterResult]async fn BrokerConnection::delete_groups(self : BrokerConnection, groups : Array[String], timeout_ms? : Int) -> Array[AdminDeletedGroup]async fn BrokerConnection::delete_records(self : BrokerConnection, topics : Array[(String, Array[(Int, Int64)])], timeout_ms : Int) -> Array[DeleteRecordsResult]async fn BrokerConnection::delete_share_group_offsets(self : BrokerConnection, group_id : String, topics : Array[String], timeout_ms? : Int) -> ShareOffsetDeleteResultasync fn BrokerConnection::delete_topics(self : BrokerConnection, names : Array[String], topic_ids : Array[Uuid], timeout_ms : Int) -> Array[DeleteTopicsResult]async fn BrokerConnection::describe_acls(self : BrokerConnection, filter : AclFilter, timeout_ms? : Int) -> DescribeAclsResultasync fn BrokerConnection::describe_client_quotas(self : BrokerConnection, filter : ClientQuotaFilter, timeout_ms? : Int) -> DescribeClientQuotasResultasync fn BrokerConnection::describe_cluster(self : BrokerConnection, include_authorized_operations? : Bool, include_fenced_brokers? : Bool, timeout_ms? : Int) -> AdminClusterDescriptionasync fn BrokerConnection::describe_configs(self : BrokerConnection, resources : Array[ConfigResourceKey], timeout_ms? : Int) -> Array[AdminConfigsResult]async fn BrokerConnection::describe_consumer_groups(self : BrokerConnection, group_ids : Array[String], include_authorized_operations? : Bool, timeout_ms? : Int) -> Array[AdminConsumerGroupDescription]async fn BrokerConnection::describe_groups(self : BrokerConnection, groups : Array[String], include_authorized_operations? : Bool, timeout_ms? : Int) -> Array[AdminGroupDescription]async fn BrokerConnection::describe_log_dirs(self : BrokerConnection, topics? : Array[(String, Array[Int])]?, timeout_ms? : Int) -> AdminLogDirsasync fn BrokerConnection::describe_producers(self : BrokerConnection, topics : Array[(String, Array[Int])], timeout_ms? : Int) -> Array[AdminDescribeProducersTopic]async fn BrokerConnection::describe_quorum(self : BrokerConnection, topics : Array[(String, Array[Int])], timeout_ms? : Int) -> AdminQuorumDescriptionasync fn BrokerConnection::describe_share_group_offsets(self : BrokerConnection, groups : Array[ShareOffsetDescribeGroup], timeout_ms? : Int) -> Array[ShareOffsetDescribeGroupResult]async fn BrokerConnection::describe_topic_partitions(self : BrokerConnection, topics : Array[String], response_partition_limit? : Int, cursor? : TopicPartitionCursor?, timeout_ms? : Int) -> DescribeTopicPartitionsasync fn BrokerConnection::describe_transactions(self : BrokerConnection, transactional_ids : Array[String], timeout_ms? : Int) -> Array[AdminDescribeTransaction]async fn BrokerConnection::describe_user_scram(self : BrokerConnection, users : Array[String]?, timeout_ms? : Int) -> DescribeUserScramResultasync fn BrokerConnection::elect_leaders(self : BrokerConnection, election_type : Int, topic_partitions? : Array[(String, Array[Int])]?, timeout_ms? : Int) -> AdminElectionResultasync fn BrokerConnection::end_txn(self : BrokerConnection, transactional_id : String, producer_id : Int64, producer_epoch : Int, committed : Bool, timeout_ms? : Int) -> EndTxnResultasync fn BrokerConnection::fetch(self : BrokerConnection, topics : Array[FetchTopicReq], session~ : FetchSessionReq, max_wait_ms~ : Int, min_bytes? : Int, max_bytes? : Int, isolation_level? : Int, timeout_ms? : Int) -> FetchResultasync fn BrokerConnection::fetch_metadata(self : BrokerConnection, topics : Array[String]?, timeout_ms? : Int) -> Metadataasync fn BrokerConnection::find_coordinator(self : BrokerConnection, keys : Array[String], coordinator_type : CoordinatorType, timeout_ms? : Int) -> Array[CoordinatorInfo]async fn BrokerConnection::get_telemetry_subscriptions(self : BrokerConnection, client_instance_id : Uuid, timeout_ms? : Int) -> (TelemetrySubscription, Int)async fn BrokerConnection::group_heartbeat(self : BrokerConnection, group_id : String, generation_id : Int, member_id : String, group_instance_id? : String?, timeout_ms? : Int) -> Intasync fn BrokerConnection::incremental_alter_configs(self : BrokerConnection, resources : Array[AlterableConfigResource], timeout_ms? : Int, validate_only? : Bool) -> Array[AlterConfigsResult]async fn BrokerConnection::init_producer_id(self : BrokerConnection, transactional_id? : String?, transaction_timeout_ms? : Int, producer_id? : Int64, producer_epoch? : Int, timeout_ms? : Int) -> InitProducerIdResultasync fn BrokerConnection::join_group(self : BrokerConnection, group_id : String, session_timeout_ms : Int, rebalance_timeout_ms : Int, member_id : String, group_instance_id? : String?, protocols~ : Array[JoinGroupProtocol], timeout_ms? : Int) -> JoinGroupResultasync fn BrokerConnection::leave_group(self : BrokerConnection, group_id : String, member_id : String, group_instance_id? : String?, timeout_ms? : Int) -> Intasync fn BrokerConnection::list_config_resources(self : BrokerConnection, resource_types? : Array[Int], timeout_ms? : Int) -> ListConfigResourcesResultasync fn BrokerConnection::list_groups(self : BrokerConnection, states_filter : Array[String], types_filter : Array[String], timeout_ms? : Int) -> AdminListGroupsResultasync fn BrokerConnection::list_offsets(self : BrokerConnection, topic : String, partitions : Array[PartitionInfo], timestamp : Int64, timeout_ms? : Int) -> Map[Int, Int64]async fn BrokerConnection::list_partition_reassignments(self : BrokerConnection, topics? : Array[(String, Array[Int])]?, timeout_ms? : Int) -> AdminOngoingReassignmentsasync fn BrokerConnection::list_transactions(self : BrokerConnection, state_filters : Array[String], producer_id_filters : Array[Int64], duration_filter : Int64, transactional_id_pattern : String?, timeout_ms? : Int) -> AdminListTransactionsResultasync fn BrokerConnection::negotiate_api_versions(self : BrokerConnection, timeout_ms? : Int) -> Unitasync fn BrokerConnection::offset_commit(self : BrokerConnection, group_id : String, generation_id_or_member_epoch : Int, member_id : String, group_instance_id? : String?, topics~ : Array[CommitTopic], timeout_ms? : Int) -> Array[OffsetCommitPartitionResult]async fn BrokerConnection::offset_delete(self : BrokerConnection, group_id : String, topics : Array[(String, Array[Int])], timeout_ms : Int) -> OffsetDeleteResultasync fn BrokerConnection::offset_fetch(self : BrokerConnection, group_id : String, member_id? : String, member_epoch? : Int, topics~ : Array[FetchOffsetTopic], require_stable? : Bool, timeout_ms? : Int) -> Array[OffsetFetchGroupResult]async fn BrokerConnection::offset_for_leader_epoch(self : BrokerConnection, topic : String, partitions : Array[(Int, Int, Int)], timeout_ms? : Int) -> Array[EpochEndOffset]async fn BrokerConnection::produce(self : BrokerConnection, topic : String, topic_id? : Uuid, transactional_id? : String?, partitions~ : Array[(Int, Bytes)], acks~ : Int, timeout_ms~ : Int) -> Array[ProducePartitionResult]async fn BrokerConnection::push_telemetry(self : BrokerConnection, client_instance_id : Uuid, subscription_id : Int, metrics : Bytes, terminating? : Bool, compression_type? : Int, timeout_ms? : Int) -> Intasync fn BrokerConnection::request(self : BrokerConnection, api_key : Int, api_version : Int, body : Bytes, timeout_ms? : Int) -> Decoderasync fn BrokerConnection::request_raw(self : BrokerConnection, api_key : Int, api_version : Int, body : Bytes, timeout_ms? : Int, flexible? : Bool) -> Decoderasync fn BrokerConnection::send_only(self : BrokerConnection, api_key : Int, api_version : Int, body : Bytes) -> Unitasync fn BrokerConnection::share_acknowledge(self : BrokerConnection, group_id : String, member_id : String, session_epoch : Int, topics : Array[ShareFetchTopic], timeout_ms? : Int) -> ShareAcknowledgeResultasync fn BrokerConnection::share_fetch(self : BrokerConnection, group_id : String, member_id : String, session_epoch : Int, topics : Array[ShareFetchTopic], forgotten? : Array[ShareForgottenTopic], max_wait_ms~ : Int, timeout_ms? : Int) -> ShareFetchResultasync fn BrokerConnection::share_group_heartbeat(self : BrokerConnection, group_id : String, member_id : String, member_epoch : Int, rack_id? : String?, subscribed_topic_names? : Array[String]?, timeout_ms? : Int) -> ShareGroupHeartbeatResultasync fn BrokerConnection::sync_group(self : BrokerConnection, group_id : String, generation_id : Int, member_id : String, group_instance_id? : String?, protocol_name? : String, assignments~ : Array[SyncGroupAssignment], timeout_ms? : Int) -> SyncGroupResultasync fn BrokerConnection::txn_offset_commit(self : BrokerConnection, transactional_id : String, group_id : String, producer_id : Int64, producer_epoch : Int, topics : Array[(String, Array[TxnOffset])], timeout_ms? : Int) -> Array[TxnPartitionResult]async fn BrokerConnection::unregister_broker(self : BrokerConnection, broker_id : Int, timeout_ms? : Int) -> UnregisterBrokerResultasync fn BrokerConnection::update_features(self : BrokerConnection, updates : Array[FeatureUpdate], timeout_ms? : Int, validate_only? : Bool) -> AdminUpdateFeaturesResultpub(all) struct ClientQuotaAlteration {
entity : Array[QuotaEntity]
ops : Array[ClientQuotaOp]
} derive(Debug)pub(all) struct ClientQuotaFilter {
components : Array[ClientQuotaFilterComponent]
strict : Bool
} derive(Debug)pub(all) struct ClientQuotaFilterComponent {
entity_type : String
match_type : Int
matches : String?
} derive(Debug)pub struct ClientQuotasEntry {
entity : Array[QuotaEntity]
values : Array[ClientQuotaValue]
} derive(Debug)pub struct ClusterClient {
bootstrap : BootstrapServers
client_id : String
request_timeout_ms : Int
metadata_max_age_ms : Int
max_in_flight : Int
sasl : SaslConfig?
use_tls : Bool
tls_options : TlsClientOptions?
lock : Mutex
brokers : Map[Int, BrokerInfo]
topics : Map[String, TopicMetadata]
topic_ids : Map[Uuid, String]
controller_id : Int
refreshed_ms : Int64
conns : Map[Int, BrokerConnection]
// private fields
}async fn ClusterClient::connect(bootstrap_addresses : Array[HostPort], client_id? : String, request_timeout_ms? : Int, metadata_max_age_ms? : Int, max_in_flight? : Int, sasl? : SaslConfig?, use_tls? : Bool, tls? : TlsClientOptions?) -> ClusterClientasync fn ClusterClient::coordinator(self : ClusterClient, keys : Array[String], coordinator_type : CoordinatorType) -> Map[String, CoordinatorInfo]async fn ClusterClient::wait_for_topic(self : ClusterClient, topic : String, timeout_ms? : Int) -> TopicMetadatapub(all) struct CommittedOffset {
topic : String
partition : Int
offset : Int64
leader_epoch : Int
error_code : Int
} derive(Debug)pub struct CommonConfig {
bootstrap_servers : Array[String]
client_id : String
request_timeout_ms : Int
connection_max_idle_ms : Int
metadata_max_age_ms : Int
retries : Int
retry_backoff_ms : Int
retry_backoff_max_ms : Int
security_protocol : SecurityProtocol
sasl : SaslConfig?
tls : TlsClientOptions?
} derive(Debug)fn CommonConfig::new(bootstrap_servers : Array[String], request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, metadata_max_age_ms? : Int) -> CommonConfig raisepub struct Consumer {
topic : String
start_from : StartFrom
request_timeout_ms : Int
retries : Int
retry_backoff_ms : Int
retry_backoff_max_ms : Int
group : TaskGroup[Unit]
enable_auto_commit : Bool
auto_commit_interval_ms : Int
auto_offset_reset : AutoOffsetReset
max_poll_records : Int
max_partition_fetch_bytes : Int
enable_read_committed : Bool
heartbeat_interval_ms : Int
session_timeout_ms : Int
last_poll_ms : Int64
max_poll_interval_ms : Int
group_protocol : GroupProtocol
topic_id : Uuid
fetch_sessions : Map[Int, FetchSession]
partitions : Array[PartitionState]
closed : Bool
// private fields
}async fn Consumer::connect_with_config(group~ : TaskGroup[Unit], config : ConsumerConfig) -> Consumerfn Consumer::subscribe(self : Consumer, topics : Array[String], listener? : RebalanceListener?) -> Unit raiseasync fn Consumer::subscribe_regex(self : Consumer, pattern : String, listener? : RebalanceListener?) -> Unitpub struct ConsumerConfig {
common : CommonConfig
topic : String
start_from : StartFrom
group_id : String?
enable_auto_commit : Bool
auto_commit_interval_ms : Int
auto_offset_reset : AutoOffsetReset
max_poll_records : Int
max_partition_fetch_bytes : Int
enable_read_committed : Bool
group_instance_id : String?
heartbeat_interval_ms : Int
session_timeout_ms : Int
max_poll_interval_ms : Int
group_protocol : GroupProtocol
} derive(Debug)fn ConsumerConfig::new(bootstrap_servers : Array[String], topic : String, start_from? : StartFrom, request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, metadata_max_age_ms? : Int, group_id? : String?, enable_auto_commit? : Bool, auto_commit_interval_ms? : Int, auto_offset_reset? : AutoOffsetReset?, max_poll_records? : Int, max_partition_fetch_bytes? : Int, enable_read_committed? : Bool, group_instance_id? : String?, heartbeat_interval_ms? : Int, session_timeout_ms? : Int, max_poll_interval_ms? : Int, group_protocol? : GroupProtocol) -> ConsumerConfig raisepub struct ConsumerGroupHeartbeatResult {
error_code : Int
error_message : String?
member_id : String
member_epoch : Int
heartbeat_interval_ms : Int
assignment : Array[HeartbeatTopicPartitions]
} derive(Debug)pub struct CoordinatorInfo {
key : String
node_id : Int
host : String
port : Int
error_code : Int
error_message : String?
} derive(Debug)pub struct CreatePartitionsResult {
name : String
error_code : Int
error_message : String?
} derive(Debug)pub struct DeleteAclsFilterResult {
error_code : Int
error_message : String?
matching_acls : Array[DeletedAcl]
} derive(Debug)pub struct DeleteRecordsResult {
topic : String
partition : Int
low_watermark : Int64
error_code : Int
} derive(Debug)pub struct DeletedAcl {
error_code : Int
error_message : String?
binding : AclBinding
} derive(Debug)pub struct DescribeAclsResult {
error_code : Int
error_message : String?
resources : Array[DescribedAclResource]
} derive(Debug)pub struct DescribeClientQuotasResult {
error_code : Int
error_message : String?
entries : Array[ClientQuotasEntry]
} derive(Debug)pub struct DescribeTopicPartitions {
topics : Array[TopicMetadata]
next_cursor : TopicPartitionCursor?
}pub struct DescribeUserScramResult {
error_code : Int
error_message : String?
results : Array[DescribedScramCredentials]
} derive(Debug)pub struct DescribedAclResource {
resource_type : Int
resource_name : String
pattern_type : Int
acls : Array[AclDescription]
} derive(Debug)pub struct DescribedScramCredentials {
user : String
error_code : Int
error_message : String?
credential_infos : Array[ScramCredentialInfo]
} derive(Debug)pub struct ElectLeadersPartitionResult {
partition : Int
error_code : Int
error_message : String?
} derive(Debug)pub struct ElectLeadersTopicResult {
topic : String
partitions : Array[ElectLeadersPartitionResult]
} derive(Debug)pub struct EpochEndOffset {
partition : Int
error_code : Int
leader_epoch : Int
end_offset : Int64
} derive(Debug)pub(all) struct FeatureUpdate {
feature : String
max_version_level : Int
upgrade_type : Int
} derive(Debug)pub(all) struct FetchPartitionReq {
index : Int
leader_epoch : Int
fetch_offset : Int64
max_bytes : Int
} derive(Debug)fn FetchSession::handle_response(self : FetchSession, response_session_id : Int, top_error_code : Int) -> Unitfn FetchSession::prepare(self : FetchSession, topic_name : String, topic_id : Uuid, wanted : Map[Int, (Int64, Int)], max_bytes : Int) -> FetchSessionReqpub(all) struct FetchSessionReq {
session_id : Int
session_epoch : Int
partitions : Array[FetchPartitionReq]
forgotten : Array[FetchTopicForgotten]
} derive(Debug)pub(all) struct FetchTopicReq {
name : String
topic_id : Uuid
partitions : Array[FetchPartitionReq]
} derive(Debug)pub struct FetchTopicResult {
name : String
topic_id : Uuid
partitions : Array[FetchPartitionResult]
}pub(all) struct GroupMetadata {
group_id : String
member_id : String
generation_id : Int
} derive(Debug)pub struct InitProducerIdResult {
producer_id : Int64
producer_epoch : Int
error_code : Int
} derive(Debug)pub struct JoinGroupMember {
member_id : String
group_instance_id : String?
metadata : Bytes
} derive(Debug)pub struct JoinGroupResult {
error_code : Int
generation_id : Int
protocol_name : String
leader_id : String
member_id : String
members : Array[JoinGroupMember]
} derive(Debug)pub struct ListConfigResourcesResult {
error_code : Int
resources : Array[ConfigResourceListing]
} derive(Debug)pub(all) struct LogDirPartition {
partition_index : Int
partition_size : Int64
offset_lag : Int64
is_future : Bool
} derive(Debug)pub struct LogDirResult {
error_code : Int
log_dir : String
topics : Array[LogDirTopic]
total_bytes : Int64
usable_bytes : Int64
is_cordoned : Bool
} derive(Debug)pub struct Metadata {
brokers : Map[Int, BrokerInfo]
controller_id : Int
topics : Array[TopicMetadata]
}pub struct OffsetDeletePartitionResult {
topic : String
partition : Int
error_code : Int
} derive(Debug)pub struct OffsetDeleteResult {
error_code : Int
partitions : Array[OffsetDeletePartitionResult]
} derive(Debug)pub struct OffsetFetchGroupResult {
group_id : String
error_code : Int
partitions : Array[CommittedOffset]
} derive(Debug)pub struct ProducePartitionResult {
partition : Int
error_code : Int
base_offset : Int64
log_append_time : Int64
log_start_offset : Int64
record_errors : Array[ProduceRecordError]
error_message : String?
}pub struct Producer {
topic : String
acks : Int
timeout_ms : Int
retries : Int
retry_backoff_ms : Int
retry_backoff_max_ms : Int
delivery_timeout_ms : Int
group : TaskGroup[Unit]
enable_idempotence : Bool
producer_id : Int64
producer_epoch : Int
topic_id : Uuid
partitions : Array[PartitionInfo]
closed : Bool
// private fields
}async fn Producer::connect_with_config(group~ : TaskGroup[Unit], config : ProducerConfig) -> Producerasync fn Producer::send_handle(self : Producer, key? : Bytes, value? : Bytes, timestamp? : Int64, partition? : Int, headers? : Array[(Bytes, Bytes)]) -> SendHandlepub struct ProducerConfig {
common : CommonConfig
topic : String
acks : Int
partitioner : Partitioner
batch_size : Int
linger_ms : Int
buffer_memory : Int
max_in_flight : Int
delivery_timeout_ms : Int
enable_idempotence : Bool
transactional_id : String?
transaction_timeout_ms : Int
} derive(Debug)fn ProducerConfig::new(bootstrap_servers : Array[String], topic : String, acks? : Int, request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, partitioner? : Partitioner, batch_size? : Int, linger_ms? : Int, buffer_memory? : Int, metadata_max_age_ms? : Int, max_in_flight? : Int, delivery_timeout_ms? : Int, enable_idempotence? : Bool?, transactional_id? : String?, transaction_timeout_ms? : Int) -> ProducerConfig raisepub struct ProducerMetrics {
records_queued : Int
bytes_queued : Int
batches_in_flight : Int
records_sent : Int
records_failed : Int
batches_sent : Int
batches_failed : Int
throttle_time_ms : Int64
} derive(Debug)pub struct QuorumPartitionState {
partition_index : Int
error_code : Int
error_message : String?
leader_id : Int
leader_epoch : Int
high_watermark : Int64
current_voters : Array[QuorumReplicaState]
observers : Array[QuorumReplicaState]
} derive(Debug)pub struct QuorumTopicState {
topic_name : String
partitions : Array[QuorumPartitionState]
} derive(Debug)pub struct ReassignablePartitionResponse {
partition_index : Int
error_code : Int
error_message : String?
} derive(Debug)pub(all) struct ReassignableTopic {
name : String
partitions : Array[ReassignablePartition]
} derive(Debug)fn RebalanceListener::new(on_assign~ : (Array[(String, Int)]) -> Unit, on_revoke~ : (Array[(String, Int)]) -> Unit) -> RebalanceListenerfn RecordBatchBuilder::append(self : RecordBatchBuilder, timestamp : Int64, key? : Bytes?, value? : Bytes?, headers? : Array[(Bytes, Bytes)]) -> Unitfn RecordBatchBuilder::estimated_append_size(self : RecordBatchBuilder, timestamp : Int64, key? : Bytes?, value? : Bytes?, headers? : Array[(Bytes, Bytes)]) -> Intfn RecordBatchBuilder::set_idempotence(self : RecordBatchBuilder, producer_id : Int64, producer_epoch : Int, base_sequence : Int) -> Unitpub(all) struct SaslAuthenticateResult {
error_code : Int
error_message : String?
auth_bytes : Bytes?
session_lifetime_ms : Int64
}pub(all) struct SaslConfig {
mechanism : SaslMechanism
username : String
password : String
oauth_token_provider : () -> String raise?
}impl Debug for SaslConfigpub(all) struct ScramCredentialUpsertion {
name : String
mechanism : Int
iterations : Int
salt : Bytes
salted_password : Bytes
} derive(Debug)fn ScramCredentialUpsertion::from_password(name : String, mechanism : Int, password : Bytes, iterations? : Int) -> ScramCredentialUpsertion raisepub struct SendHandle {
// private fields
}pub(all) struct SendRecord {
key : Bytes?
value : Bytes?
timestamp : Int64?
partition : Int?
headers : Array[(Bytes, Bytes)]
}pub(all) struct SettableConfigResource {
resource_type : Int
resource_name : String
configs : Array[SettableConfig]
} derive(Debug)pub struct ShareAcknowledgePartitionResult {
partition : Int
error_code : Int
error_message : String?
leader_id : Int
leader_epoch : Int
} derive(Debug)pub struct ShareAcknowledgeResult {
error_code : Int
error_message : String?
acquisition_lock_timeout_ms : Int
topics : Array[ShareAcknowledgeTopicResult]
} derive(Debug)pub struct ShareAcknowledgeTopicResult {
topic_id : Uuid
partitions : Array[ShareAcknowledgePartitionResult]
} derive(Debug)pub(all) struct ShareAcquiredRange {
first_offset : Int64
last_offset : Int64
delivery_count : Int
} derive(Debug)pub struct ShareConsumer {
topic : String
topic_id : Uuid
group_id : String
start_from : StartFrom
max_queue_size : Int
delivery_count_limit : Int
request_timeout_ms : Int
retries : Int
retry_backoff_ms : Int
retry_backoff_max_ms : Int
group : TaskGroup[Unit]
partitions : Array[PartitionInfo]
closed : Bool
// private fields
}async fn ShareConsumer::acknowledge(self : ShareConsumer, records : Array[ShareRecord], action : ShareAckType) -> Array[ShareAcknowledgeTopicResult]async fn ShareConsumer::connect_with_config(group~ : TaskGroup[Unit], config : ShareConsumerConfig) -> ShareConsumerasync fn ShareConsumer::poll(self : ShareConsumer, max_wait_ms? : Int, max_records? : Int) -> Array[ShareRecord]pub struct ShareConsumerConfig {
common : CommonConfig
topic : String
group_id : String
start_from : StartFrom
max_queue_size : Int
delivery_count_limit : Int
request_timeout_ms : Int
} derive(Debug)fn ShareConsumerConfig::new(bootstrap_servers : Array[String], topic : String, group_id : String, start_from? : StartFrom, request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, metadata_max_age_ms? : Int, max_queue_size? : Int, delivery_count_limit? : Int) -> ShareConsumerConfig raisepub(all) struct ShareFetchPartition {
partition : Int
acknowledgment_batches : Array[ShareAckBatch]
} derive(Debug)pub struct ShareFetchPartitionResult {
partition : Int
error_code : Int
error_message : String?
acknowledge_error_code : Int
acknowledge_error_message : String?
leader_id : Int
leader_epoch : Int
records : Array[Record]
batches : Array[DecodedBatch]
records_complete : Bool
acquired : Array[ShareAcquiredRange]
} derive(Debug)pub struct ShareFetchResult {
error_code : Int
error_message : String?
acquisition_lock_timeout_ms : Int
topics : Array[ShareFetchTopicResult]
} derive(Debug)pub(all) struct ShareFetchTopic {
topic_id : Uuid
partitions : Array[ShareFetchPartition]
} derive(Debug)pub struct ShareFetchTopicResult {
topic_id : Uuid
partitions : Array[ShareFetchPartitionResult]
} derive(Debug)pub struct ShareGroupHeartbeatResult {
error_code : Int
error_message : String?
member_id : String
member_epoch : Int
heartbeat_interval_ms : Int
assignment : Array[ShareHeartbeatTopicPartitions]
} derive(Debug)pub(all) struct ShareOffsetAlterPartitionResult {
partition : Int
error_code : Int
error_message : String?
} derive(Debug)pub struct ShareOffsetAlterResult {
error_code : Int
error_message : String?
topics : Array[ShareOffsetAlterTopicResult]
} derive(Debug)pub(all) struct ShareOffsetAlterTopic {
name : String
partitions : Array[ShareOffsetAlterPartition]
} derive(Debug)pub(all) struct ShareOffsetAlterTopicResult {
name : String
topic_id : Uuid
partitions : Array[ShareOffsetAlterPartitionResult]
} derive(Debug)pub struct ShareOffsetDeleteResult {
error_code : Int
error_message : String?
topics : Array[ShareOffsetDeleteTopicResult]
} derive(Debug)pub(all) struct ShareOffsetDescribeGroup {
group_id : String
topics : Array[ShareOffsetDescribeTopic]?
} derive(Debug)pub(all) struct ShareOffsetDescribeGroupResult {
group_id : String
topics : Array[ShareOffsetDescribeTopicResult]
error_code : Int
error_message : String?
} derive(Debug)pub(all) struct ShareOffsetDescribePartition {
partition : Int
start_offset : Int64
leader_epoch : Int
lag : Int64
error_code : Int
error_message : String?
} derive(Debug)pub(all) struct ShareOffsetDescribeTopicResult {
name : String
topic_id : Uuid
partitions : Array[ShareOffsetDescribePartition]
} derive(Debug)pub struct SyncGroupResult {
error_code : Int
protocol_name : String
assignment : Bytes
} derive(Debug)pub struct TelemetryClient {
cluster : ClusterClient
group : TaskGroup[Unit]
max_push_bytes : Int
metrics_provider : () -> Bytes
// private fields
}async fn TelemetryClient::connect_with_config(group~ : TaskGroup[Unit], config : TelemetryClientConfig) -> TelemetryClientpub struct TelemetryClientConfig {
common : CommonConfig
client_instance_id : Uuid
max_push_bytes : Int
metrics_provider : () -> Bytes
}fn TelemetryClientConfig::new(bootstrap_servers : Array[String], client_instance_id? : Uuid, max_push_bytes? : Int, metrics_provider~ : () -> Bytes, request_timeout_ms? : Int, security_protocol? : SecurityProtocol, sasl? : SaslConfig?, tls? : TlsClientOptions?, metadata_max_age_ms? : Int) -> TelemetryClientConfig raisepub(all) struct TlsClientOptions {
server_name : String
verify_certificates : Bool
ca_pem_file : String?
} derive(Debug)fn TlsClientOptions::new(server_name : String, verify_certificates? : Bool, ca_pem_file? : String?) -> TlsClientOptionspub struct TopicMetadata {
name : String
error_code : Int
topic_id : Uuid
is_internal : Bool
partitions : Array[PartitionInfo]
}let ACL_OPERATION_TWO_PHASE_COMMIT : Intlet ACL_OPERATION_UNKNOWN : Intlet ACL_PATTERN_MATCH : Intlet ACL_PATTERN_UNKNOWN : Intlet ACL_PERMISSION_UNKNOWN : Intlet ACL_RESOURCE_UNKNOWN : Intlet AUTHORIZED_OPERATIONS_NONE : Intlet CONFIG_OP_SET : Intlet CONFIG_RESOURCE_UNKNOWN : Intlet ELECTION_PREFERRED : Intlet ENDPOINT_TYPE_BROKERS : Intlet FEATURE_UPGRADE : Intlet GROUP_ID_NOT_FOUND : Intlet GROUP_MEMBER_TYPE_UNKNOWN : Intlet OFFSET_EARLIEST_PENDING_UPLOAD : Int64let OFFSET_LOCAL_LOG_START : Int64let OFFSET_MAX_TIMESTAMP : Int64let QUOTA_MATCH_EXACT : Intlet SCRAM_MECHANISM_SHA_256 : Intfn backoff_ms(base_ms : Int, max_ms : Int, attempt : Int) -> Intasync fn connect_bootstrap(servers : BootstrapServers, client_id : String, timeout_ms? : Int, sasl? : SaslConfig?, use_tls? : Bool, tls? : TlsClientOptions?) -> BrokerConnectionfn decode_alter_client_quotas_response(version : Int, d : Decoder) -> (Array[AlterClientQuotasResult], Int) raisefn decode_alter_partition_reassignments_response(version : Int, d : Decoder) -> (AdminReassignmentResult, Int) raisefn decode_consumer_group_describe_response(d : Decoder) -> (Array[AdminConsumerGroupDescription], Int) raisefn decode_consumer_group_heartbeat_response(d : Decoder) -> (ConsumerGroupHeartbeatResult, Int) raisefn decode_describe_client_quotas_response(version : Int, d : Decoder) -> (DescribeClientQuotasResult, Int) raisefn decode_describe_cluster_response(version : Int, d : Decoder) -> (AdminClusterDescription, Int) raisefn decode_describe_producers_response(d : Decoder) -> (Array[AdminDescribeProducersTopic], Int) raisefn decode_describe_share_group_offsets_response(version : Int, d : Decoder) -> (Array[ShareOffsetDescribeGroupResult], Int) raisefn decode_describe_transactions_response(d : Decoder) -> (Array[AdminDescribeTransaction], Int) raisefn decode_list_config_resources_response(version : Int, d : Decoder) -> (ListConfigResourcesResult, Int) raisefn decode_list_partition_reassignments_response(d : Decoder) -> (AdminOngoingReassignments, Int) raisefn decode_offset_commit_response(version : Int, d : Decoder) -> (Array[OffsetCommitPartitionResult], Int) raisefn decode_offset_fetch_response(version : Int, d : Decoder) -> (Array[OffsetFetchGroupResult], Int) raisefn decode_produce_response(version : Int, d : Decoder) -> (Array[ProducePartitionResult], Int) raisefn decode_share_acknowledge_response(version : Int, d : Decoder) -> (ShareAcknowledgeResult, Int) raisefn encode_add_offsets_to_txn_request(transactional_id : String, producer_id : Int64, producer_epoch : Int, group_id : String) -> Bytesfn encode_alter_client_quotas_request(entries : Array[ClientQuotaAlteration], validate_only : Bool, version : Int) -> Bytesfn encode_alter_configs_request(resources : Array[SettableConfigResource], validate_only : Bool) -> Bytesfn encode_alter_partition_reassignments_request(topics : Array[ReassignableTopic], timeout_ms : Int, allow_replication_factor_change : Bool, version : Int) -> Bytesfn encode_alter_share_group_offsets_request(group_id : String, topics : Array[ShareOffsetAlterTopic]) -> Bytesfn encode_alter_user_scram_request(deletions : Array[ScramCredentialDeletion], upsertions : Array[ScramCredentialUpsertion]) -> Bytesfn encode_consumer_group_describe_request(group_ids : Array[String], include_authorized_operations : Bool) -> Bytesfn encode_consumer_group_heartbeat_request(version : Int, group_id : String, member_id : String, member_epoch : Int, instance_id? : String?, rack_id? : String?, rebalance_timeout_ms? : Int, subscribed_topic_names? : Array[String]?, subscribed_topic_regex? : String?, server_assignor? : String?) -> Bytes raisefn encode_create_partitions_request(topics : Array[CreatePartitionsSpec], timeout_ms : Int, validate_only : Bool) -> Bytesfn encode_create_topics_request(topics : Array[CreatableTopic], timeout_ms : Int, validate_only : Bool) -> Bytesfn encode_describe_cluster_request(include_cluster_authorized_operations : Bool, include_fenced_brokers : Bool, version : Int) -> Bytesfn encode_describe_groups_request(groups : Array[String], include_authorized_operations : Bool) -> Bytesfn encode_describe_topic_partitions_request(topics : Array[String], response_partition_limit : Int, cursor? : TopicPartitionCursor?) -> Bytesfn encode_end_txn_request(transactional_id : String, producer_id : Int64, producer_epoch : Int, committed : Bool) -> Bytesfn encode_fetch_request(version : Int, topics : Array[FetchTopicReq], session~ : FetchSessionReq, max_wait_ms~ : Int, min_bytes? : Int, max_bytes? : Int, isolation_level? : Int, rack_id? : String) -> Bytes raisefn encode_find_coordinator_request(keys : Array[String], coordinator_type : CoordinatorType) -> Bytesfn encode_heartbeat_request(group_id : String, generation_id : Int, member_id : String, group_instance_id? : String?) -> Bytesfn encode_incremental_alter_configs_request(resources : Array[AlterableConfigResource], validate_only : Bool) -> Bytesfn encode_init_producer_id_request(transactional_id : String?, transaction_timeout_ms : Int, producer_id : Int64, producer_epoch : Int) -> Bytesfn encode_join_group_request(group_id : String, session_timeout_ms : Int, rebalance_timeout_ms : Int, member_id : String, group_instance_id? : String?, protocols~ : Array[JoinGroupProtocol]) -> Bytesfn encode_leave_group_request(group_id : String, member_id : String, group_instance_id? : String?) -> Bytesfn encode_list_offsets_request(version : Int, topic : String, partitions : Array[PartitionInfo], timestamp : Int64, timeout_ms? : Int) -> Bytes raisefn encode_offset_commit_request(version : Int, group_id : String, generation_id_or_member_epoch : Int, member_id : String, group_instance_id : String?, topics : Array[CommitTopic]) -> Bytes raisefn encode_offset_fetch_request(version : Int, group_id : String, member_id : String, member_epoch : Int, topics : Array[FetchOffsetTopic], require_stable? : Bool) -> Bytes raisefn encode_offset_for_leader_epoch_request(topic : String, partitions : Array[(Int, Int, Int)], timeout_ms? : Int) -> Bytesfn encode_push_telemetry_request(client_instance_id : Uuid, subscription_id : Int, terminating : Bool, compression_type : Int, metrics : Bytes) -> Bytesfn encode_request(api_key : Int, api_version : Int, correlation_id : Int, client_id : String, body : Bytes, flexible? : Bool) -> Bytesfn encode_sasl_authenticate_request(auth_bytes : Bytes) -> Bytesfn encode_sasl_handshake_request(mechanism : String) -> Bytesfn encode_share_acknowledge_request(version : Int, group_id : String, member_id : String, session_epoch : Int, topics : Array[ShareFetchTopic]) -> Bytes raisefn encode_share_fetch_request(version : Int, group_id : String, member_id : String, session_epoch : Int, topics : Array[ShareFetchTopic], forgotten~ : Array[ShareForgottenTopic], max_wait_ms~ : Int, min_bytes? : Int, max_bytes? : Int, max_records? : Int, batch_size? : Int) -> Bytes raisefn encode_share_group_heartbeat_request(version : Int, group_id : String, member_id : String, member_epoch : Int, rack_id? : String?, subscribed_topic_names? : Array[String]?) -> Bytes raisefn encode_sync_group_request(group_id : String, generation_id : Int, member_id : String, group_instance_id? : String?, protocol_name? : String, assignments~ : Array[SyncGroupAssignment]) -> Bytesfn encode_unregister_broker_request(broker_id : Int) -> Bytesfn encode_update_features_request(updates : Array[FeatureUpdate], timeout_ms : Int, validate_only : Bool) -> Bytesfn error_name(code : Int) -> Stringfn error_retriable(code : Int) -> Boolfn scram_auth_message(client_first_bare : String, server_first : String, client_final_without_proof : String) -> Stringfn scram_client_proof_b64(sha512 : Bool, salted_password : Bytes, auth_message : String) -> Stringfn scram_escape_username(username : String) -> Stringfn[H : CryptoHasher] scram_pbkdf2_hmac(h : H, password : Bytes, salt : Bytes, iterations : Int, dk_len : Int) -> Bytesfn scram_salted_password(sha512 : Bool, password : Bytes, salt : Bytes, iterations : Int) -> Bytesfn scram_server_final(sha512 : Bool, salted_password : Bytes, auth_message : String) -> Stringfn scram_server_signature_b64(sha512 : Bool, salted_password : Bytes, auth_message : String) -> Stringfn scram_verify_client_proof(sha512 : Bool, salted_password : Bytes, auth_message : String, proof_b64 : String) -> BoolInstall
Download zipOpen-source Apache Kafka client driver written in pure MoonBit
Dependencies