Skip to main content
Version: dev 🚧

DynamicTaskExecutor

fastkafka.executors.DynamicTaskExecutor​

View source

A class that implements a dynamic task executor for processing consumer records.

The DynamicTaskExecutor class extends the StreamExecutor class and provides functionality for running a tasks in parallel using asyncio.Task.

init​

View source
__init__(
self, throw_exceptions=False, max_buffer_size=100000, size=100000
)

Create an instance of DynamicTaskExecutor

Parameters:

NameTypeDescriptionDefault
throw_exceptionsboolFlag indicating whether exceptions should be thrown ot logged.Defaults to False.False
max_buffer_sizeintMaximum buffer size for the memory object stream.Defaults to 100_000.100000
sizeintSize of the task pool. Defaults to 100_000.100000

run​

View source
run(
self, is_shutting_down_f, generator, processor
)

Runs the dynamic task executor.

Parameters:

NameTypeDescriptionDefault
is_shutting_down_fCallable[[], bool]Function to check if the executor is shutting down.required
generatorCallable[[], Awaitable[aiokafka.structs.ConsumerRecord]]Generator function for retrieving consumer records.required
processorCallable[[aiokafka.structs.ConsumerRecord], Awaitable[NoneType]]Processor function for processing consumer records.required