keiro
Safe HaskellNone
LanguageGHC2024

Keiro.Inbox.Kafka

Description

Reconstruct an IntegrationEvent from Kafka payload bytes plus headers.

This module is the receiving-side counterpart of integrationEventToKafkaRecord. It is pure: the caller supplies the bytes and the Text-keyed header map produced by its Kafka adapter, and gets back a decoded envelope or a typed error.

keiro itself does not depend on hw-kafka-client or shibuya-kafka-adapter; the consumer adapter in EP-22 bridges the broker library's header type to [(Text, Text)] before calling integrationEventFromKafka.

Synopsis

Documentation

data KafkaInboundRecord Source #

A Kafka record as seen by the consumer-side adapter, decoupled from the broker library's record type.

Constructors

KafkaInboundRecord 

Fields

Instances

Instances details
Generic KafkaInboundRecord Source # 
Instance details

Defined in Keiro.Inbox.Kafka

Show KafkaInboundRecord Source # 
Instance details

Defined in Keiro.Inbox.Kafka

Eq KafkaInboundRecord Source # 
Instance details

Defined in Keiro.Inbox.Kafka

type Rep KafkaInboundRecord Source # 
Instance details

Defined in Keiro.Inbox.Kafka

data KafkaDecodeError Source #

Typed failures from integrationEventFromKafka.

Instances

Instances details
Generic KafkaDecodeError Source # 
Instance details

Defined in Keiro.Inbox.Kafka

Show KafkaDecodeError Source # 
Instance details

Defined in Keiro.Inbox.Kafka

Eq KafkaDecodeError Source # 
Instance details

Defined in Keiro.Inbox.Kafka

type Rep KafkaDecodeError Source # 
Instance details

Defined in Keiro.Inbox.Kafka

integrationEventFromKafka :: KafkaInboundRecord -> Either KafkaDecodeError (IntegrationEvent, KafkaDeliveryRef) Source #

Reconstruct a full IntegrationEvent plus the KafkaDeliveryRef recorded for diagnostics.

The reconstruction is faithful to the canonical header names defined by Event (e.g. keiro-message-id, keiro-source, traceparent). Missing required headers (keiro-source, keiro-destination, keiro-event-type, keiro-schema-version, content-type, keiro-message-id) produce MissingHeader; malformed numeric or UUID headers produce InvalidIntHeader / InvalidUuidHeader. Optional headers are silently absent in the resulting envelope.