Copyright | (c) 2016-19 Brian W Bush |
---|---|
License | MIT |
Maintainer | Brian W Bush <code@functionally.io> |
Stability | Production |
Portability | Portable |
Safe Haskell | None |
Language | Haskell2010 |
Produce and consume events on Kafka topics.
Synopsis
- data TopicConnection = TopicConnection {}
- type Sensor = String
- type LoopAction = IO (Either KafkaClientError ())
- type ExitAction = IO ()
- type ConsumerCallback = Sensor -> Event -> IO ()
- consumerLoop :: TopicConnection -> ConsumerCallback -> IO (ExitAction, LoopAction)
- type ProducerCallback = IO [Event]
- producerLoop :: TopicConnection -> Sensor -> ProducerCallback -> IO (ExitAction, LoopAction)
Types
data TopicConnection Source #
Connection information for a Kafka topic.
Instances
type LoopAction = IO (Either KafkaClientError ()) Source #
Action for iterating to produce or consume events.
type ExitAction = IO () Source #
Action for ending iteration.
Consumption
type ConsumerCallback Source #
= Sensor | The name of the sensor producing the event. |
-> Event | The event. |
-> IO () | The action for consuming the event. |
Callback for consuming events from a sensor.
:: TopicConnection | The Kafka topic name and connection information. |
-> ConsumerCallback | The consumer callback. |
-> IO (ExitAction, LoopAction) | Action to create the exit and loop actions. |
Consume events for a Kafka topic.
Production
type ProducerCallback Source #
Callback for producing events from a sensor.
:: TopicConnection | The Kafka topic name and connection information. |
-> Sensor | The name of the sensor producing the event. |
-> ProducerCallback | The producer callback. |
-> IO (ExitAction, LoopAction) | Action to create the exit and loop actions. |
Produce events for a Kafka topic.