12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- import Crdkafka
16
15
import Logging
17
16
import NIOConcurrencyHelpers
18
17
import NIOCore
@@ -122,7 +121,7 @@ public final class KafkaConsumer: Sendable, Service {
122
121
self . config = config
123
122
self . logger = logger
124
123
125
- let client = try RDKafka . createClient (
124
+ let client = try RDKafkaClient . makeClient (
126
125
type: . consumer,
127
126
configDictionary: config. dictionary,
128
127
events: [ . log, . fetch, . offsetCommit] ,
@@ -149,8 +148,8 @@ public final class KafkaConsumer: Sendable, Service {
149
148
)
150
149
}
151
150
152
- // Events that would be triggered by ``KafkaClient /poll(timeout:)``
153
- // are now triggered by ``KafkaClient /consumerPoll``.
151
+ // Events that would be triggered by ``RDKafkaClient /poll(timeout:)``
152
+ // are now triggered by ``RDKafkaClient /consumerPoll``.
154
153
try client. pollSetConsumer ( )
155
154
156
155
switch config. consumptionStrategy. _internal {
@@ -289,7 +288,7 @@ public final class KafkaConsumer: Sendable, Service {
289
288
}
290
289
291
290
private func _triggerGracefulShutdown(
292
- client: KafkaClient ,
291
+ client: RDKafkaClient ,
293
292
logger: Logger
294
293
) {
295
294
do {
@@ -323,27 +322,27 @@ extension KafkaConsumer {
323
322
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
324
323
/// - Parameter source: ``NIOAsyncSequenceProducer/Source`` used for yielding new elements.
325
324
case initializing(
326
- client: KafkaClient ,
325
+ client: RDKafkaClient ,
327
326
source: Producer . Source
328
327
)
329
328
/// The ``KafkaConsumer`` is consuming messages.
330
329
///
331
330
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
332
331
/// - Parameter source: ``NIOAsyncSequenceProducer/Source`` used for yielding new elements.
333
332
case consuming(
334
- client: KafkaClient ,
333
+ client: RDKafkaClient ,
335
334
source: Producer . Source
336
335
)
337
336
/// Consumer is still running but the messages asynchronous sequence was terminated.
338
337
/// All incoming messages will be dropped.
339
338
///
340
339
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
341
- case consumptionStopped( client: KafkaClient )
340
+ case consumptionStopped( client: RDKafkaClient )
342
341
/// The ``KafkaConsumer/triggerGracefulShutdown()`` has been invoked.
343
342
/// We are now in the process of commiting our last state to the broker.
344
343
///
345
344
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
346
- case finishing( client: KafkaClient )
345
+ case finishing( client: RDKafkaClient )
347
346
/// The ``KafkaConsumer`` is closed.
348
347
case finished
349
348
}
@@ -354,7 +353,7 @@ extension KafkaConsumer {
354
353
/// Delayed initialization of `StateMachine` as the `source` and the `pollClosure` are
355
354
/// not yet available when the normal initialization occurs.
356
355
mutating func initialize(
357
- client: KafkaClient ,
356
+ client: RDKafkaClient ,
358
357
source: Producer . Source
359
358
) {
360
359
guard case . uninitialized = self . state else {
@@ -373,15 +372,15 @@ extension KafkaConsumer {
373
372
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
374
373
/// - Parameter source: ``NIOAsyncSequenceProducer/Source`` used for yielding new elements.
375
374
case pollForAndYieldMessage(
376
- client: KafkaClient ,
375
+ client: RDKafkaClient ,
377
376
source: Producer . Source
378
377
)
379
378
/// The ``KafkaConsumer`` stopped consuming messages or
380
379
/// is in the process of shutting down.
381
380
/// Poll to serve any queued events and commit outstanding state to the broker.
382
381
///
383
382
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
384
- case pollWithoutYield( client: KafkaClient )
383
+ case pollWithoutYield( client: RDKafkaClient )
385
384
/// Terminate the poll loop.
386
385
case terminatePollLoop
387
386
}
@@ -416,7 +415,7 @@ extension KafkaConsumer {
416
415
enum SetUpConnectionAction {
417
416
/// Set up the connection through ``subscribe()`` or ``assign()``.
418
417
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
419
- case setUpConnection( client: KafkaClient )
418
+ case setUpConnection( client: RDKafkaClient )
420
419
}
421
420
422
421
/// Get action to be taken when wanting to set up the connection through ``subscribe()`` or ``assign()``.
@@ -458,7 +457,7 @@ extension KafkaConsumer {
458
457
enum StoreOffsetAction {
459
458
/// Store the message offset with the given `client`.
460
459
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
461
- case storeOffset( client: KafkaClient )
460
+ case storeOffset( client: RDKafkaClient )
462
461
}
463
462
464
463
/// Get action to take when wanting to store a message offset (to be auto-committed by `librdkafka`).
@@ -483,7 +482,7 @@ extension KafkaConsumer {
483
482
///
484
483
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
485
484
case commitSync(
486
- client: KafkaClient
485
+ client: RDKafkaClient
487
486
)
488
487
/// Throw an error. The ``KafkaConsumer`` is closed.
489
488
case throwClosedError
@@ -514,14 +513,14 @@ extension KafkaConsumer {
514
513
///
515
514
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
516
515
case triggerGracefulShutdown(
517
- client: KafkaClient
516
+ client: RDKafkaClient
518
517
)
519
518
/// Shut down the ``KafkaConsumer`` and finish the given `source` object.
520
519
///
521
520
/// - Parameter client: Client used for handling the connection to the Kafka cluster.
522
521
/// - Parameter source: ``NIOAsyncSequenceProducer/Source`` used for yielding new elements.
523
522
case triggerGracefulShutdownAndFinishSource(
524
- client: KafkaClient ,
523
+ client: RDKafkaClient ,
525
524
source: Producer . Source
526
525
)
527
526
}
0 commit comments