Closed assembly-winston closed 3 months ago
@assembly-winston Just leave out the Config.Queues
property, and a client will become insert-only, and not perform any background work.
// Config is the configuration for a Client.
type Config struct {
...
// Queues is a list of queue names for this client to operate on along with
// configuration for the queue like the maximum number of workers to run for
// each queue.
//
// This field may be omitted for a program that's only queueing jobs rather
// than working them. If it's specified, then Workers must also be given.
Queues map[string]QueueConfig
You can also leave out Config.Workers
from an insert-only client, but it's a little better to leave it in because if you do, River will be able to validate that workers for inserted jobs exist. i.e. Helps detect an accidental misconfiguration where a worker was omitted from the Workers
bundle.
If I have say, 2 servers that submit jobs to a river queue but I only want 1 of them to be doing background work, what is the way to do that? Can the server not intended to do work do InsertTx(SomeArgs) for a SomeWorker which we didn't river.AddWorkers(SomeWorker{}) on?
Sorry if that was confusing.