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
* `KafkaConsumerConfig` add `SwiftKafka` options
Motivation:
We want to use the `KafkaConsumerConfig` to determine if the
`KafkaConsumer` is part of a consumer-group (subscription) or assinged
to a single partition of a topic (assingment). This should also be
implemented in a way that errors are caught at compile time.
Furthermore, we want users to be able to determine a
`BackPressureStrategy` for their respective `KafkaClient`.
Modifications:
* add two new configuration options to `KafkaConsumerConfig`:
`ConsumptionStrategy` and `BackPressureStrategy`
* remove `KafkaConsumerConfig`'s `groupID` option, this is now taken
care of by the `consumptionStrategy` option, which is better as this
ensures at compile time that now groupID mismatch errors occur
* rename `KafkaProducerConfig` back to `ConfigEnums` as it is not really
meant for shared configurations, rather as a namespace for _all_
configuration options
* update README
* * move setting group.id to `KafkaConsumerConfig`
* * fix soundness
* * rename `ConfigEnums` -> `KafkaSharedConfiguration`
* Review Franz
Modifications:
* fix wrong Docc comments
* remove implicitly unwrapped optional
* rename `highLowWatermark(lowWatermark:,highWatermark:)` to
`watermark(low:,high:)`
* `ConsumptionStrategy`: remove *Based suffixes
* replace type of `KafkaConsumer.offset`: `Int64` -> `Int`
* * fix docc nits
After initializing the `KafkaConsumer` with a topic-partition pair to read from, messages can be consumed using the `messages`[`AsyncSequence`](https://developer.apple.com/documentation/swift/asyncsequence).
37
37
38
38
```swift
39
-
let config =KafkaConsumerConfig(bootstrapServers: ["localhost:9092"])
39
+
let config =KafkaConsumerConfig(
40
+
consumptionStrategy: .partition(
41
+
topic: "topic-name",
42
+
partition: KafkaPartition(rawValue: 0)
43
+
),
44
+
bootstrapServers: ["localhost:9092"]
45
+
)
40
46
41
47
let consumer =tryKafkaConsumer(
42
-
topic: "topic-name",
43
-
partition: KafkaPartition(rawValue: 0),
44
48
config: config,
45
49
logger: .kafkaTest// Your logger here
46
50
)
@@ -61,12 +65,11 @@ SwiftKafka also allows users to subscribe to an array of topics as part of a con
/// Client group session and failure detection timeout. The consumer sends periodic heartbeats (heartbeat.interval.ms) to indicate its liveness to the broker. If no hearts are received by the broker for a group member within the session timeout, the broker will remove the consumer from the group and trigger a rebalance. The allowed range is configured with the broker configuration properties group.min.session.timeout.ms and group.max.session.timeout.ms. Also see max.poll.interval.ms.
/// Action to take when there is no initial offset in offset store or the desired offset is out of range. See ``ConfigEnums/AutoOffsetReset`` for more information.
89
+
/// Action to take when there is no initial offset in offset store or the desired offset is out of range. See ``KafkaSharedConfiguration/AutoOffsetReset`` for more information.
0 commit comments