Background Server selective processing

Hi there,

I have a need across multiple web servers to

  1. Receive an inbound message
  2. Retrieve keys a, b and c from said message (what the keys are is not important. They just uniquely identify this message as being a part of a given group)
  3. Persist this message to Hangfire persistence with both the message and the keys (as in BackgroundJob.Enqueue(() => ProcessMessage(Message, Key1, Key2, Key3));
  4. When this message is picked up for processing, have the backgroundserver process ONLY messages which match particular keys.

What I don’t want is to have the background server pick up a message, read it, realize this is not a message it cares about (based on the keys) and stuff it back on the queue. The expected behaviour would be that the background server would receive a message only if it was configured to read such messages.

Is such a thing possible using Hangfire?

You can put them in different queues based upon the keys and then set the servers to only process specific queues.

1 Like