@@ -130,6 +130,10 @@ public IAdditionalActions MoveToErrorQueue()
130
130
131
131
public IAdditionalActions Requeue ( int maxAttempts = 3 )
132
132
{
133
+ if ( maxAttempts > 25 )
134
+ throw new ArgumentOutOfRangeException ( nameof ( maxAttempts ) ,
135
+ "Wolverine allows a maximum of 25 attempts, see the RequeueIndefinitely() option" ) ;
136
+
133
137
for ( var i = 0 ; i < maxAttempts - 1 ; i ++ )
134
138
{
135
139
var slot = _rule . AddSlot ( RequeueContinuation . Instance ) ;
@@ -138,6 +142,13 @@ public IAdditionalActions Requeue(int maxAttempts = 3)
138
142
139
143
return this ;
140
144
}
145
+
146
+ public IAdditionalActions RequeueIndefinitely ( )
147
+ {
148
+ _rule . InfiniteSource = RequeueContinuation . Instance ;
149
+
150
+ return this ;
151
+ }
141
152
142
153
public IAdditionalActions PauseThenRequeue ( TimeSpan delay )
143
154
{
@@ -159,6 +170,10 @@ public IAdditionalActions ScheduleRetry(params TimeSpan[] delays)
159
170
{
160
171
throw new InvalidOperationException ( "You must specify at least one delay time" ) ;
161
172
}
173
+
174
+ if ( delays . Length > 25 )
175
+ throw new ArgumentOutOfRangeException ( nameof ( delays ) ,
176
+ "Wolverine allows a maximum of 25 attempts, see the ScheduleRetryIndefinitely() option" ) ;
162
177
163
178
for ( var i = 0 ; i < delays . Length ; i ++ )
164
179
{
@@ -200,6 +215,10 @@ public IAdditionalActions RetryTimes(int attempts)
200
215
{
201
216
throw new ArgumentOutOfRangeException ( nameof ( attempts ) ) ;
202
217
}
218
+
219
+ if ( attempts > 25 )
220
+ throw new ArgumentOutOfRangeException ( nameof ( attempts ) ,
221
+ "Wolverine allows a maximum of 25 attempts, maybe see one of the indefinite requeue or reschedule policies" ) ;
203
222
204
223
for ( var i = 0 ; i < attempts ; i ++ )
205
224
{
@@ -216,6 +235,11 @@ public IAdditionalActions RetryWithCooldown(params TimeSpan[] delays)
216
235
{
217
236
throw new InvalidOperationException ( "You must specify at least one delay time" ) ;
218
237
}
238
+
239
+ if ( delays . Length > 25 )
240
+ throw new ArgumentOutOfRangeException ( nameof ( delays ) ,
241
+ "Wolverine allows a maximum of 25 attempts, maybe see one of the indefinite requeue or reschedule policies" ) ;
242
+
219
243
220
244
for ( var i = 0 ; i < delays . Length ; i ++ )
221
245
{
@@ -280,6 +304,13 @@ public interface IFailureActions
280
304
/// <param name="maxAttempts">The maximum number of attempts to process the message. The default is 3</param>
281
305
IAdditionalActions Requeue ( int maxAttempts = 3 ) ;
282
306
307
+ /// <summary>
308
+ /// Requeue the message back to the incoming transport no matter how many times
309
+ /// the message has failed. Use with caution obviously!!!!!
310
+ /// </summary>
311
+ /// <returns></returns>
312
+ IAdditionalActions RequeueIndefinitely ( ) ;
313
+
283
314
/// <summary>
284
315
/// Discard the message without any further attempt to process the message
285
316
/// </summary>
@@ -365,6 +396,11 @@ public IAdditionalActions Requeue(int maxAttempts = 3)
365
396
return new FailureActions ( _match , _parent ) . Requeue ( maxAttempts ) ;
366
397
}
367
398
399
+ public IAdditionalActions RequeueIndefinitely ( )
400
+ {
401
+ return new FailureActions ( _match , _parent ) . RequeueIndefinitely ( ) ;
402
+ }
403
+
368
404
/// <summary>
369
405
/// Discard the message without any further attempt to process the message
370
406
/// </summary>
0 commit comments