Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module with producer properties types and functions.
Synopsis
- data ProducerProperties = ProducerProperties {}
- brokersList :: [BrokerAddress] -> ProducerProperties
- setCallback :: Callback -> ProducerProperties
- logLevel :: KafkaLogLevel -> ProducerProperties
- compression :: KafkaCompressionCodec -> ProducerProperties
- topicCompression :: KafkaCompressionCodec -> ProducerProperties
- sendTimeout :: Timeout -> ProducerProperties
- statisticsInterval :: Millis -> ProducerProperties
- extraProps :: Map Text Text -> ProducerProperties
- suppressDisconnectLogs :: ProducerProperties
- extraTopicProps :: Map Text Text -> ProducerProperties
- debugOptions :: [KafkaDebug] -> ProducerProperties
- deliveryCallback :: (DeliveryReport -> IO ()) -> Callback
- errorCallback :: (KafkaError -> String -> IO ()) -> Callback
- logCallback :: (KafkaLogLevel -> String -> String -> IO ()) -> Callback
- statsCallback :: (ByteString -> IO ()) -> Callback
- data Callback
Documentation
data ProducerProperties Source #
Properties to create KafkaProducer
.
ProducerProperties | |
|
Instances
Semigroup ProducerProperties Source # | |
Defined in Kafka.Producer.ProducerProperties (<>) :: ProducerProperties -> ProducerProperties -> ProducerProperties # sconcat :: NonEmpty ProducerProperties -> ProducerProperties # stimes :: Integral b => b -> ProducerProperties -> ProducerProperties # | |
Monoid ProducerProperties Source # | Right biased so we prefer newer properties over older ones. |
Defined in Kafka.Producer.ProducerProperties |
brokersList :: [BrokerAddress] -> ProducerProperties Source #
Set the list of brokers to contact to connect to the Kafka cluster.
logLevel :: KafkaLogLevel -> ProducerProperties Source #
Sets the logging level.
Usually is used with debugOptions
to configure which logs are needed.
compression :: KafkaCompressionCodec -> ProducerProperties Source #
Set the compression.codec for the producer.
topicCompression :: KafkaCompressionCodec -> ProducerProperties Source #
Set the compression.codec for the topic.
sendTimeout :: Timeout -> ProducerProperties Source #
Set the message.timeout.ms.
statisticsInterval :: Millis -> ProducerProperties Source #
Set the statistics.interval.ms for the producer.
extraProps :: Map Text Text -> ProducerProperties Source #
Any configuration options that are supported by librdkafka. The full list can be found here
suppressDisconnectLogs :: ProducerProperties Source #
Suppresses producer disconnects logs.
It might be useful to turn this off when interacting with brokers with an aggressive connection.max.idle.ms value.
extraTopicProps :: Map Text Text -> ProducerProperties Source #
Any *topic* configuration options that are supported by librdkafka. The full list can be found here
debugOptions :: [KafkaDebug] -> ProducerProperties Source #
deliveryCallback :: (DeliveryReport -> IO ()) -> Callback Source #
Sets the callback for delivery reports.
/Note: A callback should not be a long-running process as it blocks librdkafka from continuing on the thread that handles the delivery callbacks. For callbacks to individual messsages see 'Kafka.Producer.produceMessage''./
errorCallback :: (KafkaError -> String -> IO ()) -> Callback Source #
Add a callback for errors.
Examples
Basic usage:
'setCallback' ('errorCallback' myErrorCallback) myErrorCallback :: 'KafkaError' -> String -> IO () myErrorCallback kafkaError message = print $ show kafkaError <> "|" <> message
logCallback :: (KafkaLogLevel -> String -> String -> IO ()) -> Callback Source #
Add a callback for logs.
Examples
Basic usage:
'setCallback' ('logCallback' myLogCallback) myLogCallback :: 'KafkaLogLevel' -> String -> String -> IO () myLogCallback level facility message = print $ show level <> "|" <> facility <> "|" <> message
statsCallback :: (ByteString -> IO ()) -> Callback Source #
Add a callback for stats. The passed ByteString contains an UTF-8 encoded JSON document and can e.g. be parsed using Data.Aeson.decodeStrict. For more information about the content of the JSON document see https://github.com/edenhill/librdkafka/blob/master/STATISTICS.md.
Examples
Basic usage:
'setCallback' ('statsCallback' myStatsCallback) myStatsCallback :: String -> IO () myStatsCallback stats = print $ show stats
Callbacks allow retrieving various information like error occurences, statistics
and log messages.
See setCallback
(Consumer) and setCallback
(Producer) for more details.