31
31
ProducerErrorCallback ,
32
32
default_on_processing_error ,
33
33
)
34
+ from .internal_consumer import InternalConsumer
35
+ from .internal_producer import InternalProducer
34
36
from .kafka import AutoOffsetReset , ConnectionConfig , Consumer , Producer
35
37
from .logging import LogLevel , configure_logging
36
38
from .models import (
50
52
is_quix_deployment ,
51
53
)
52
54
from .processing import ProcessingContext
53
- from .rowconsumer import RowConsumer
54
- from .rowproducer import RowProducer
55
55
from .runtracker import RunTracker
56
56
from .sinks import SinkManager
57
57
from .sources import BaseSource , SourceException , SourceManager
66
66
ProcessingGuarantee = Literal ["at-least-once" , "exactly-once" ]
67
67
MessageProcessedCallback = Callable [[str , int , int ], None ]
68
68
69
- # Enforce idempotent producing for the internal RowProducer
69
+ # Enforce idempotent producing for InternalProducer
70
70
_default_producer_extra_config = {"enable.idempotence" : True }
71
71
72
72
# Default config for the internal consumer
@@ -198,8 +198,8 @@ def __init__(
198
198
Default - `"state"`.
199
199
:param rocksdb_options: RocksDB options.
200
200
If `None`, the default options will be used.
201
- :param consumer_poll_timeout: timeout for `RowConsumer .poll()`. Default - `1.0`s
202
- :param producer_poll_timeout: timeout for `RowProducer .poll()`. Default - `0`s.
201
+ :param consumer_poll_timeout: timeout for `InternalConsumer .poll()`. Default - `1.0`s
202
+ :param producer_poll_timeout: timeout for `InternalProducer .poll()`. Default - `0`s.
203
203
:param on_message_processed: a callback triggered when message is successfully
204
204
processed.
205
205
:param loglevel: a log level for "quixstreams" logger.
@@ -227,11 +227,11 @@ def __init__(
227
227
exceptions occur on different stages of stream processing. If the callback
228
228
returns `True`, the exception will be ignored. Otherwise, the exception
229
229
will be propagated and the processing will eventually stop.
230
- :param on_consumer_error: triggered when internal `RowConsumer ` fails
230
+ :param on_consumer_error: triggered when internal `InternalConsumer ` fails
231
231
to poll Kafka or cannot deserialize a message.
232
232
:param on_processing_error: triggered when exception is raised within
233
233
`StreamingDataFrame.process()`.
234
- :param on_producer_error: triggered when `RowProducer ` fails to serialize
234
+ :param on_producer_error: triggered when `InternalProducer ` fails to serialize
235
235
or to produce a message to Kafka.
236
236
<br><br>***Quix Cloud Parameters***<br>
237
237
:param quix_config_builder: instance of `QuixKafkaConfigsBuilder` to be used
@@ -335,11 +335,11 @@ def __init__(
335
335
self ._on_message_processed = on_message_processed
336
336
self ._on_processing_error = on_processing_error or default_on_processing_error
337
337
338
- self ._consumer = self ._get_rowconsumer (
338
+ self ._consumer = self ._get_internal_consumer (
339
339
on_error = on_consumer_error ,
340
340
extra_config_overrides = consumer_extra_config_overrides ,
341
341
)
342
- self ._producer = self ._get_rowproducer (on_error = on_producer_error )
342
+ self ._producer = self ._get_internal_producer (on_error = on_producer_error )
343
343
self ._running = False
344
344
self ._failed = False
345
345
@@ -577,21 +577,21 @@ def stop(self, fail: bool = False):
577
577
if self ._state_manager .using_changelogs :
578
578
self ._state_manager .stop_recovery ()
579
579
580
- def _get_rowproducer (
580
+ def _get_internal_producer (
581
581
self ,
582
582
on_error : Optional [ProducerErrorCallback ] = None ,
583
583
transactional : Optional [bool ] = None ,
584
- ) -> RowProducer :
584
+ ) -> InternalProducer :
585
585
"""
586
- Create a RowProducer using the application config
586
+ Create InternalProducer using the application config
587
587
588
588
Used to create the application producer as well as the sources producers
589
589
"""
590
590
591
591
if transactional is None :
592
592
transactional = self ._config .exactly_once
593
593
594
- return RowProducer (
594
+ return InternalProducer (
595
595
broker_address = self ._config .broker_address ,
596
596
extra_config = self ._config .producer_extra_config ,
597
597
flush_timeout = self ._config .flush_timeout ,
@@ -628,13 +628,13 @@ def get_producer(self) -> Producer:
628
628
extra_config = self ._config .producer_extra_config ,
629
629
)
630
630
631
- def _get_rowconsumer (
631
+ def _get_internal_consumer (
632
632
self ,
633
633
on_error : Optional [ConsumerErrorCallback ] = None ,
634
634
extra_config_overrides : Optional [dict ] = None ,
635
- ) -> RowConsumer :
635
+ ) -> InternalConsumer :
636
636
"""
637
- Create a RowConsumer using the application config
637
+ Create an InternalConsumer using the application config
638
638
639
639
Used to create the application consumer as well as the sources consumers
640
640
"""
@@ -644,7 +644,7 @@ def _get_rowconsumer(
644
644
** self ._config .consumer_extra_config ,
645
645
** extra_config_overrides ,
646
646
}
647
- return RowConsumer (
647
+ return InternalConsumer (
648
648
broker_address = self ._config .broker_address ,
649
649
consumer_group = self ._config .consumer_group ,
650
650
auto_offset_reset = self ._config .auto_offset_reset ,
@@ -734,8 +734,8 @@ def add_source(self, source: BaseSource, topic: Optional[Topic] = None) -> Topic
734
734
self ._source_manager .register (
735
735
source ,
736
736
topic ,
737
- self ._get_rowproducer (transactional = False ),
738
- self ._get_rowconsumer (
737
+ self ._get_internal_producer (transactional = False ),
738
+ self ._get_internal_consumer (
739
739
extra_config_overrides = consumer_extra_config_overrides
740
740
),
741
741
self ._get_topic_manager (),
0 commit comments