You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Felice is client library for [Apache Kafka](http://kafka.apache.org) in Clojure.
8
9
9
10
Built with simplicity it mind, it support by default JSON, Transit & Nippy (Fast | LZ4) and
10
11
provide also custom Serializer / Deserializer mechanism
11
12
12
-
See [API docs](https://it-dev.pages.oscaroad.com/felice/)
13
-
14
-
## Installation
15
-
16
-
Add the latest release to your **project.clj**
17
-
18
-
```
19
-
[com.oscaro/felice "2.6.0-1.3"]
20
-
```
13
+
> Note: the version contains in a first time the [Kafka Client](https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients) then the felice version, separated by hyphen.
"Fetch data for the topics or partitions specified using one of the subscribe/assign APIs. This method returns immediately if there are records available. Otherwise, it will await the timeout ms. If the timeout expires, an empty record set will be returned."
109
+
"Fetch data for the topics or partitions specified using
110
+
one of the subscribe/assign APIs.
111
+
112
+
This method returns immediately if there are records available.
113
+
Otherwise, it will await the timeout ms.
114
+
115
+
If the timeout expires, an empty record set will be returned."
108
116
[^KafkaConsumer consumer timeout]
109
117
(.poll consumer (Duration/ofMillis timeout)))
110
118
111
119
(defnwakeup
112
-
"Wakeup the consumer. This method is thread-safe and is useful in particular to abort a long poll.
113
-
The thread which is blocking in an operation will throw WakeupException. If no thread is blocking in a method which can throw WakeupException, the next call to such a method will raise it instead."
120
+
"Wakeup the consumer. This method is thread-safe and is
121
+
useful in particular to abort a long poll.
122
+
123
+
The thread which is blocking in an operation will throw WakeupException.
124
+
125
+
If no thread is blocking in a method which can throw WakeupException,
126
+
the next call to such a method will raise it instead."
114
127
[^KafkaConsumer consumer]
115
128
(.wakeup consumer))
116
129
117
130
(defnconsumer-record->map
118
-
"transforms a ConsumerRecord to a clojure map containing :key :value :offset :topic :partition :timestamp :timestamp-type and :header "
131
+
"transforms a ConsumerRecord to a clojure map containing:
"Invoking this method makes all buffered records immediately available to send (even if linger.ms is greater than 0) and blocks on the completion of the requests associated with these records."
8
+
"Invoking this method makes all buffered records immediately available
9
+
to send (even if linger.ms is greater than 0) and blocks on the
10
+
completion of the requests associated with these records."
9
11
[^KafkaProducer producer]
10
12
(.flush producer))
11
13
@@ -20,12 +22,13 @@
20
22
(.partitionsFor producer topic))
21
23
22
24
(defn ^:no-doc producer-record
23
-
"transforms a clojure map to a ProducerRecord object"
25
+
"Transforms a clojure map to a ProducerRecord object"
24
26
[{:keys [topic key value partition timestamp headers]}]
25
27
(ProducerRecord. topic partition timestamp key value headers))
26
28
27
29
(defn ^:no-doc send-record!
28
-
"sends a ProducerRecord with an optional callback when the send has been acknowledged."
30
+
"Sends a ProducerRecord with an optional callback when the
31
+
send has been acknowledged."
29
32
([^KafkaProducer producer ^ProducerRecord record]
30
33
(.send producer (producer-record record)))
31
34
([^KafkaProducer producer ^ProducerRecord record callback]
"asynchronously send a record triggering the given callback when the send has been acknowledged
51
-
Note that callbacks will generally execute in the I/O thread of the producer and so should be reasonably fast or they will delay the sending of messages from other threads. If you want to execute blocking or computationally expensive callbacks it is recommended to use your own Executor in the callback body to parallelize processing."
53
+
"Asynchronously send a record triggering the given callback when the send has
54
+
been acknowledged.
55
+
Note that callbacks will generally execute in the I/O thread of the producer
56
+
and so should be reasonably fast or they will delay the sending of messages
57
+
from other threads.
58
+
59
+
If you want to execute blocking or computationally expensive callbacks it
60
+
is recommended to use your own Executor in the callback body to parallelize
@@ -75,16 +86,12 @@ with the 1 argument arity, :key.serializer and :value.serializer must be provide
75
86
:value.serializer value-serializer))))
76
87
77
88
(defnclose!
78
-
"This method waits up to timeout ms for the producer to complete the sending of all incomplete requests.
79
-
If the producer is unable to complete all requests before the timeout expires, this method will fail any unsent and unacknowledged records immediately.
89
+
"This method waits up to timeout ms for the producer to complete the
90
+
sending of all incomplete requests.
91
+
92
+
If the producer is unable to complete all requests before the timeout
93
+
expires, this method will fail any unsent and unacknowledged records immediately.
94
+
80
95
Calling close with no timeout is equivalent to close(Long.MAX_VALUE, TimeUnit.MILLISECONDS)"
0 commit comments