franz

Types

pub opaque type ClientBuilder
pub type ClientConfig {
  RestartDelaySeconds(Int)
  GetMetadataTimeoutSeconds(Int)
  ReconnectCoolDownSeconds(Int)
  AllowTopicAutoCreation(Bool)
  AutoStartProducers(Bool)
  DefaultProducerConfig(List(producer_config.ProducerConfig))
  UnknownTopicCacheTtl(Int)
}

Constructors

  • RestartDelaySeconds(Int)
  • GetMetadataTimeoutSeconds(Int)
  • ReconnectCoolDownSeconds(Int)
  • AllowTopicAutoCreation(Bool)
  • AutoStartProducers(Bool)
  • DefaultProducerConfig(List(producer_config.ProducerConfig))
  • UnknownTopicCacheTtl(Int)
pub type FranzClient
pub type FranzError {
  UnknownError
  ClientDown
  UnknownTopicOrPartition
  ProducerDown
  TopicAlreadyExists
  ConsumerNotFound(String)
  ProducerNotFound(String, Int)
}

Constructors

  • UnknownError
  • ClientDown
  • UnknownTopicOrPartition
  • ProducerDown
  • TopicAlreadyExists
  • ConsumerNotFound(String)
  • ProducerNotFound(String, Int)
pub type KafkaMessage {
  KafkaMessage(
    offset: Int,
    key: BitArray,
    value: BitArray,
    timestamp_type: TimeStampType,
    timestamp: Int,
    headers: List(#(String, String)),
  )
  KafkaMessageSet(
    topic: Topic,
    partition: Int,
    high_wm_offset: Int,
    messages: List(KafkaMessage),
  )
}

Constructors

  • KafkaMessage(
      offset: Int,
      key: BitArray,
      value: BitArray,
      timestamp_type: TimeStampType,
      timestamp: Int,
      headers: List(#(String, String)),
    )
  • KafkaMessageSet(
      topic: Topic,
      partition: Int,
      high_wm_offset: Int,
      messages: List(KafkaMessage),
    )
pub type Offset =
  Int
pub type Partition =
  Int
pub type TimeStampType {
  Undefined
  Create
  Append
}

Constructors

  • Undefined
  • Create
  • Append
pub type Topic =
  String

Functions

pub fn create_topic(
  bootstrap_endpoints: List(#(String, Int)),
  topic: String,
  partitions: Int,
  replication_factor: Int,
) -> Result(Nil, FranzError)
pub fn fetch(
  client: FranzClient,
  topic: String,
  partition: Int,
  offset: Int,
) -> Result(#(Int, KafkaMessage), FranzError)
pub fn new_client(
  bootstrap_endpoints: List(#(String, Int)),
) -> ClientBuilder
pub fn start(
  client_builder: ClientBuilder,
) -> Result(FranzClient, FranzError)
pub fn stop_client(client: FranzClient) -> Nil
pub fn with_config(
  client_builder: ClientBuilder,
  client_config: ClientConfig,
) -> ClientBuilder
Search Document