Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Currently, there's no way to automatically resend messages in the dead letter queue in <strong>ServiceStack</strong>. However, you can do this manually relatively easily:</p> <p>To reload messages from the dead letter queue by using:</p> <pre><code> public class AppHost { public override Configure(){ // create the hostMq ... var hostMq = new RedisMqHost( clients, retryCount = 2 ); // with retryCount = 2, 3 total attempts are made. 1st + 2 retries // before starting hostMq RecoverDLQMessages&lt;TheMessage&gt;(hostMq); // add handlers hostMq.RegisterHandler&lt;TheMessage&gt;( m =&gt; this.ServiceController.ExecuteMessage( m ) ); // start hostMq hostMq.Start(); } } </code></pre> <p>Which ultimately uses the following to recover (requeue) messages:</p> <pre><code> private void RecoverDLQMessages&lt;T&gt;( RedisMqHost hostMq ) { var client = hostMq.CreateMessageQueueClient(); var errorQueue = QueueNames&lt;T&gt;.Dlq; log.Info( "Recovering Dead Messages from: {0}", errorQueue ); var recovered = 0; byte[] msgBytes; while( (msgBytes = client.Get( errorQueue, TimeSpan.FromSeconds(1) )) != null ) { var msg = msgBytes.ToMessage&lt;T&gt;(); msg.RetryAttempts = 0; client.Publish( msg ); recovered++; } log.Info( "Recovered {0} from {1}", recovered, errorQueue ); } </code></pre> <h1>Note</h1> <p>At the time of this writing, there's a possibility of <strong>ServiceStack</strong> losing messages. <a href="https://github.com/ServiceStack/ServiceStack/issues/229" rel="nofollow">Please See Issue 229 Here</a>, so, don't kill the process while it's moving messages from the DLQ (dead letter queue) back to the input queue. Under the hood, <strong>ServiceStack</strong> is POPing messages from Redis.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload