Skip to content

fs_poison_counter

messageflux.iodevices.rabbitmq.fs_poison_counter

FileSystemPoisonCounter

FileSystemPoisonCounter(
    base_folder, file_cleanup_timeout=600
)

Bases: PoisonCounterBase

a poison counter that uses a shared folder to coordinate the consumers

it is a reasonable assumption, that at any given moment, a message is only handled by one consumer, since the queue takes care of that. therefore, there should be no race on reading/writing the file (not including cases of hash collision...)

Parameters:

Name Type Description Default
base_folder str

the shared folder path, to use for counter files. it is recommended that it will be unique per consumer group

required
file_cleanup_timeout int

the time (in seconds), after which, the counter file is considered old, and should be deleted

600

delete_counter

delete_counter(message_id)

deletes the counter file

increment_and_return_counter

increment_and_return_counter(message_id)

reads the counter file, increments the counter, and write it back to counter file

start

start()

starts the cleanup thread

stop

stop()

stops the cleanup thread