kafka_http/
types.rs

1use serde::{Deserialize, Serialize};
2
3/// Params used to create a consumer group and register a consumer
4/// Note that kafka/redpanda cleans up consumers that it has not seen in a while
5#[derive(Serialize, Deserialize, Debug)]
6pub struct CreateConsumerParams {
7    pub name: String,
8    pub format: String,
9    #[serde(rename = "auto.offset.reset")]
10    pub auto_offset_reset: String,
11}
12
13// Once a consumer and group is created, you have to subscribe to topics
14#[derive(Serialize, Deserialize, Debug)]
15pub struct SubscribeParams {
16    pub topics: Vec<String>,
17}
18
19#[derive(Serialize, Deserialize, Debug)]
20pub struct ProduceParams {
21    pub records: Vec<ProduceRecord>
22}
23
24#[derive(Serialize, Deserialize, Debug)]
25pub struct ProduceRecord {
26    pub value: String,
27}
28
29#[derive(Serialize, Deserialize, Debug)]
30pub struct Record {
31    pub topic: String,
32    pub partition: i32,
33    pub offset: i64,
34    pub value: String, // our simple string payload
35}
36
37/// A partition offset is up to where you want to mark complete in a topic
38#[derive(Serialize, Deserialize, Debug)]
39pub struct PartitionOffset {
40    pub topic: String,
41    pub partition: i32,
42    pub offset: i64,
43}
44
45#[derive(Serialize, Deserialize, Debug)]
46pub struct PartitionOffsetCommitParams {
47    pub partitions: Vec<PartitionOffset>,
48}