vgarvardt / gue

Golang queue on top of PostgreSQL
MIT License
278 stars 23 forks source link

Added support for job type filtering on workers and pool workers #292

Open kydemy-fran opened 3 months ago

kydemy-fran commented 3 months ago

I have added an option to Workers and PoolWorkers so they can filter/poll only jobs of specific job types. This way you can have several pools or services polling from the same queue, and not having to implement all job types or define a handler for unknown types. (specially if a new type is added later on)

Also, with this implementation workers will not lock unsupported jobs, blocking other workers that can process those jobs/rows.

There is more info in this issue: https://github.com/vgarvardt/gue/issues/291

I've created some functions to generate the final queries using constants, as the queries are not static anymore.

PS: If this gets merged, README/examples/documentation might need to be updated. Although the signatures are not changed and is fully compatible with the previous version.