Skip to content

feat: Add Competing-Consumer Work Queue with Acks - #2

Open
ThomasHartDev wants to merge 2 commits into
mainfrom
thomas/feat/work-queue
Open

feat: Add Competing-Consumer Work Queue with Acks#2
ThomasHartDev wants to merge 2 commits into
mainfrom
thomas/feat/work-queue

Conversation

@ThomasHartDev

Copy link
Copy Markdown
Owner

Summary

Adds an in-memory WorkQueue with competing consumers, prefetch, ack/nack, cancel requeue, and cursor round-robin. Each message goes to exactly one consumer.

Redelivery is bounded: each message id is delivered at most once per pump round, and maxDeliveryCount (default 10) drops permanent failures so a sync always-nack / always-throw / poison payload cannot busy-spin inside enqueue. Nack requeues to the tail so other ready work is not starved; cancel requeues unacked work at the head. Handler throw is treated as a requeueing nack.

Test plan

  • pnpm run typecheck
  • pnpm test (competing consumers, prefetch, ack/nack, cancel, hang bounds, nack-to-tail order)
  • pnpm run build

WorkQueue delivers each message to one consumer, with prefetch,
ack/nack requeue, and cancel redelivery for unacked work.
Deliver each message id at most once per pump round and drop after
maxDeliveryCount. Adds hang and nack-to-tail regression tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant