File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -221,9 +221,15 @@ examples we explicitly turned them off by setting the autoAck
221221remove this flag and manually send a proper acknowledgment from the
222222worker, once we're done with a task.
223223
224- After the existing _ WriteLine_ , add a call to _ BasicAck_ and update _ BasicConsume_ with _ autoAck:false_ :
225- ``` csharp reference
226- https : // github.com/rabbitmq/rabbitmq-tutorials/blob/main/dotnet/Worker/Worker.cs#L26-L32
224+ After the existing _ WriteLine_ , add a call to _ BasicAckAsync_ and update _ BasicConsumeAsync_ with _ autoAck:false_ :
225+ ``` csharp
226+ Console .WriteLine (" [x] Done" );
227+
228+ // here channel could also be accessed as ((AsyncEventingBasicConsumer)sender).Channel
229+ await channel .BasicAckAsync (deliveryTag : ea .DeliveryTag , multiple : false );
230+ };
231+
232+ await channel .BasicConsumeAsync (" hello" , autoAck : false , consumer : consumer );
227233```
228234
229235Using this code, you can ensure that even if you terminate a worker node using
You can’t perform that action at this time.
0 commit comments