Skip to content

Commit 9011a63

Browse files
Alexey RagaAlexey Raga
Alexey Raga
authored and
Alexey Raga
committed
Get off stack
1 parent 7ce8cf3 commit 9011a63

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# hw-kafka-client
2+
23
[![CircleCI](https://circleci.com/gh/haskell-works/hw-kafka-client.svg?style=svg&circle-token=5f3ada2650dd600bc0fd4787143024867b2afc4e)](https://circleci.com/gh/haskell-works/hw-kafka-client)
34

45
Kafka bindings for Haskell backed by the
56
[librdkafka C module](https://github.com/edenhill/librdkafka).
67

7-
## Credits
8-
This project is inspired by [Haskakafka](https://github.com/cosbynator/haskakafka)
9-
which unfortunately doesn't seem to be actively maintained.
10-
118
## Ecosystem
12-
HaskellWorks Kafka ecosystem is described here: https://github.com/haskell-works/hw-kafka
139

14-
# Consumer
10+
HaskellWorks Kafka ecosystem is described here: <https://github.com/haskell-works/hw-kafka>
11+
12+
## Consumer
13+
1514
High level consumers are supported by `librdkafka` starting from version 0.9.
1615
High-level consumers provide an abstraction for consuming messages from multiple
1716
partitions and topics. They are also address scalability (up to a number of partitions)
1817
by providing automatic rebalancing functionality. When a new consumer joins a consumer
1918
group the set of consumers attempt to "rebalance" the load to assign partitions to each consumer.
2019

21-
### Example:
20+
### Consumer example
21+
22+
See [Running integration tests locally](#running-integration-tests-locally) to learn how to configure a local environment.
2223

2324
```bash
24-
$ stack build --flag hw-kafka-client:examples
25+
cabal build --flag examples
2526
```
2627

2728
or
2829

2930
```bash
30-
$ stack build --exec kafka-client-example --flag hw-kafka-client:examples
31+
cabal run kafka-client-example --flag examples
3132
```
3233

3334
A working consumer example can be found here: [ConsumerExample.hs](example/ConsumerExample.hs)</br>
@@ -75,7 +76,7 @@ processMessages kafka = do
7576
return $ Right ()
7677
```
7778

78-
# Producer
79+
## Producer
7980

8081
`kafka-client` producer supports sending messages to multiple topics.
8182
Target topic name is a part of each message that is to be sent by `produceMessage`.
@@ -117,9 +118,9 @@ producerProps = brokersList [BrokerAddress "localhost:9092"]
117118
In the example above when the producer cannot deliver the message to Kafka,
118119
the error will be printed (and the message will be dropped).
119120

120-
### Example
121+
### Producer example
121122

122-
```Haskell
123+
```haskell
123124
{-# LANGUAGE OverloadedStrings #-}
124125
import Control.Exception (bracket)
125126
import Control.Monad (forM_)
@@ -166,6 +167,7 @@ mkMessage k v = ProducerRecord
166167
```
167168

168169
### Synchronous sending of messages
170+
169171
Because of the asynchronous nature of librdkafka, there is no API to provide
170172
synchronous production of messages. It is, however, possible to combine the
171173
delivery reports feature with that of callbacks. This can be done using the
@@ -234,3 +236,8 @@ After that, tests can be run as usual:
234236
```
235237
$ cabal test --test-show-details=direct
236238
```
239+
240+
## Credits
241+
242+
This project is inspired by [Haskakafka](https://github.com/cosbynator/haskakafka)
243+
which unfortunately doesn't seem to be actively maintained.

0 commit comments

Comments
 (0)