How could I add a delay in processing failed messages in ServiceStack Redis MQ

331 Views Asked by At

Is there an easy way to get Servicestack to wait x seconds before retrying a failed MQ item (using Redis MQ). At the moment it just tries 3 times consecutively with no delay.

1

There are 1 best solutions below

4
mythz On BEST ANSWER

When you register a MQ handler you can also register an error handler which gets called after publishing a failed message which you can use to add a custom delay, e.g:

mqServer.RegisterHandler<MyRequest>(
    ServiceController.ExecuteMessage,
    (msgHandler, msg, ex) => Thread.Sleep(1000));