Overview of Honker Python usage patterns
mainThe Honker Python package supports several core patterns demonstrated in the example suite:
- Task Queuing: Uses Huey-style
@queue.task()decorators. Callingadd()returns aTaskResult, and.get()can be used to wait for the worker to complete the task. It includes support for timeout-to-dead-letter paths. - Atomic Transactions: Supports committing database operations (e.g.,
INSERT INTO orders) and queue enqueues (queue.enqueue(...)) within a single transaction. If the transaction rolls back, both the database change and the queued task are dropped. - Pub/Sub:
- Ephemeral:
pg_notify-style pub/sub for transient notifications. - Durable: Pub/sub with per-consumer offset tracking and the ability to resume after a crash.
- Ephemeral:
- Scheduling: Supports time-triggered scheduling with leader election. It handles cron-style schedules,
every_s(...)intervals, and 6-field cron expressions. - Worker Loops: Provides both high-level decorated tasks and low-level async worker loops with retry-to-dead-letter logic.