Skip to content

Commit e2faa6f

Browse files
committed
Update README and source.clj to set default error-skip-offset-amount to 0
1 parent be7c593 commit e2faa6f

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Note: `int` is used for brevity but can also mean `long`. Don't worry about it.
8585
| :shape | `:value:`, `[:vector <fields>]`,`[:map <fields>]`, or an arity-1 function of `ConsumerRecord` | optional | If unspecified, channel will contain ConsumerRecord objects. [Examples](#data-shapes) |
8686
| :ketu.source/consumer-decorator | `ConsumerDecorator` | optional | [Protocol](#ketu.decorators.consumer.protocol) |
8787
| :ketu.source/poll-error-handler | `(fn [^Consumer consumer opts] ...)` | optional | Called when `poll` throws (non-wakeup) exception; should return a (possibly empty) collection of records. May mutate consumer (e.g. `seek`) and/or opts (consumer options) |
88-
| :ketu.source/error-skip-offset-amount | int | optional | Number of records to skip on a poll exception. If not set, default value is 1. |
88+
| :ketu.source/error-skip-offset-amount | int | optional | Number of records to skip on a poll exception. Default `0` (no offset change). |
8989

9090
#### Producer-sink options
9191

src/ketu/async/source.clj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
:ketu.source/consumer-close-timeout-ms 60000
4545
:ketu.source/consumer-thread-timeout-ms 60000
4646
:ketu.source/close-out-chan? true
47-
:ketu.source/close-consumer? true})
47+
:ketu.source/close-consumer? true
48+
:ketu.source/error-skip-offset-amount 0})
4849

4950
(defn- finalize-opts [opts]
5051
(-> (default-opts)
@@ -75,13 +76,13 @@
7576
(fn [consumer]
7677
(consumer/assign! consumer (consumer/topic-partitions topic partitions))))))
7778

78-
(defn- increment-offsets-for-assigned-partitions!
79+
(defn increment-offsets-for-assigned-partitions!
7980
"Increments the offset by records-to-skip for all assigned partitions to skip faulty messages.
80-
If records-to-skip is not provided, default to 1."
81+
Default skip amount is 0 (no offset change)."
8182
([^Consumer consumer source-name records-to-skip]
8283
(try
8384
(let [assigned-partitions (consumer/assignment consumer)
84-
skip-amount (or records-to-skip 1)]
85+
skip-amount records-to-skip]
8586
(doseq [^TopicPartition partition assigned-partitions]
8687
(try
8788
(let [current-position (consumer/position consumer partition)

0 commit comments

Comments
 (0)