Skip to content

feat: [#1014] add Worker.Process for push-based queue consumers - #1573

Draft
JGamboa wants to merge 3 commits into
goravel:masterfrom
JGamboa:feat/queue-worker-process
Draft

JGamboa wants to merge 3 commits into
goravel:masterfrom
JGamboa:feat/queue-worker-process

Conversation

@JGamboa

@JGamboa JGamboa commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

📑 Description

Closes goravel/goravel#1014

Adds Worker.Process(ctx, job, queue). It runs one reserved job with the exact worker semantics:

  • retries through Release and JobWithShouldRetry/tries;
  • chains;
  • failed jobs;
  • Delete.

It also reports whether the job was released. This is for platforms that push messages to the app instead of letting the worker pull them, such as AWS Lambda SQS event source mappings or Pub/Sub push subscriptions. Today a consumer like that has to copy the private worker logic.

worker := facades.Queue().Worker(queue.Args{Connection: "sqs", Tries: 3})
released, err := worker.Process(ctx, reservedJob, "jobs")
// released → keep the message (e.g. report it in batchItemFailures); otherwise it's done
  • call / processReservedJob now take how to record a failed job. The worker loop keeps using failedJobChan. Process records synchronously, because no failed-job goroutine runs outside Run.
  • processReservedJob returns (released, err). The worker loops ignore the result, so their behaviour is unchanged.

Opened as a draft to discuss the API in the issue: on Worker (as here) vs on the Queue facade.

✅ Checks

  • Added test cases for my code

Some platforms push queue messages to the application instead of letting
a worker pull them (AWS Lambda SQS event source mappings, Pub/Sub push
subscriptions). Worker.Process runs one reserved job with the exact worker
semantics (retries through Release, JobWithShouldRetry, chains, failed
jobs and Delete) and reports whether it was released, so these consumers
don't have to copy the worker's logic.

- call/processReservedJob take how to record a failed job: the worker
  loop keeps using failedJobChan, Process records it synchronously since
  no failed job goroutine runs outside Run
- processReservedJob now returns (released, err); the worker loops
  ignore it as before
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.87%. Comparing base (84af91f) to head (363e7d8).

Files with missing lines Patch % Lines
queue/worker.go 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1573      +/-   ##
==========================================
+ Coverage   72.85%   72.87%   +0.01%     
==========================================
  Files         412      412              
  Lines       26820    26826       +6     
==========================================
+ Hits        19541    19550       +9     
+ Misses       7278     7275       -3     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JGamboa
JGamboa force-pushed the feat/queue-worker-process branch from 7e2ddd6 to d9ef709 Compare October 18, 2026 20:35
…at/queue-worker-process

# Conflicts:
#	queue/worker.go
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.

✨ [Feature] Expose the worker's job processing for push-based consumers (Lambda SQS, Pub/Sub push)

1 participant