mu-kafka-0.3.0.0: Utilities for interoperation between Mu and Kafka
Safe HaskellNone
LanguageHaskell2010

Mu.Kafka.Consumer

Description

This module allows you to receive values from a Kafka topic, and treat then as Mu terms, or your Haskell types if a conversion exists.

This module is a wrapper over Source from the (awesome) package hw-kafka-client.

Synopsis

Documentation

kafkaSource :: (MonadResource m, FromSchema sch sty t, FromAvro (WithSchema sch sty t), HasAvroSchema (WithSchema sch sty t)) => Proxy sch -> ConsumerProperties -> Subscription -> Timeout -> ConduitT () (Either KafkaError (ConsumerRecord (Maybe ByteString) (Maybe t))) m () Source #

Creates a kafka producer for given properties and returns a Source.

This method of creating a Source represents a simple case and does not provide access to KafkaProducer. For more complex scenarious kafkaSinkNoClose or kafkaSinkAutoClose can be used.

kafkaSourceNoClose :: (MonadIO m, FromSchema sch sty t, FromAvro (WithSchema sch sty t), HasAvroSchema (WithSchema sch sty t)) => Proxy sch -> KafkaConsumer -> Timeout -> ConduitT () (Either KafkaError (ConsumerRecord (Maybe ByteString) (Maybe t))) m () Source #

Create a Source for a given KafkaConsumer. The consumer will NOT be closed automatically when the Source is closed.

kafkaSourceAutoClose :: (MonadResource m, FromSchema sch sty t, FromAvro (WithSchema sch sty t), HasAvroSchema (WithSchema sch sty t)) => Proxy sch -> KafkaConsumer -> Timeout -> ConduitT () (Either KafkaError (ConsumerRecord (Maybe ByteString) (Maybe t))) m () Source #

Create a Source for a given KafkaConsumer. The consumer will be closed automatically when the Source is closed.