KafkaMskEvent: {
    bootstrapServers?: null | string[];
    eventSource: "aws:kafka";
    eventSourceArn: string;
    records: Record<
        string,
        {
            headers: Record<string, string>[];
            key: string;
            offset: number;
            partition: number;
            timestamp: number;
            timestampType: string;
            topic: string;
            value: string;
        }[],
    >;
}

Zod schema for Kafka event from MSK

Type declaration

  • OptionalbootstrapServers?: null | string[]
  • eventSource: "aws:kafka"
  • eventSourceArn: string
  • records: Record<
        string,
        {
            headers: Record<string, string>[];
            key: string;
            offset: number;
            partition: number;
            timestamp: number;
            timestampType: string;
            topic: string;
            value: string;
        }[],
    >
{
"eventSource":"aws:kafka",
"eventSourceArn":"arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4",
"bootstrapServers":"b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092",
"records":{
"mytopic-0":[
{
"topic":"mytopic",
"partition":0,
"offset":15,
"timestamp":1545084650987,
"timestampType":"CREATE_TIME",
"key":"cmVjb3JkS2V5",
"value":"eyJrZXkiOiJ2YWx1ZSJ9",
"headers":[
{
"headerKey":[
104,
101,
97,
100,
101,
114,
86,
97,
108,
117,
101
]
}
]
}
]
}
}