Lev Dimov
Lev Dimov

Reputation: 41

Stopping the bus when consumer is in retry state somehow makes messages to be moved to the _skipped queue

I'm testing a message consumption retry mechanism and testing what will happen if I cancel processing (stop the bus) while message is still trying to be consumed.

Based on results of https://github.com/MassTransit/MassTransit/issues/780 I configured the bus accordingly so the pipeline can be stopped in a retry state.

configurator.UseMessageRetry(
    configurator,
    r => r.Exponential(10, 1.Seconds(), 1.Minutes(), 1.Seconds())
);

Cancellation itself works correctly. But instead of NACKing messages, they moved to the _skipped queue. And I can't understand why. Maybe because there is only 1 consumer attached to the queue?

Consume method just throws an exception to trigger a retry filter.

Am I missing something? Can I make MassTransit to NACK not retried message instead of skipping it?

Upvotes: 1

Views: 321

Answers (1)

Lev Dimov
Lev Dimov

Reputation: 41

So after a day of trial and error I found a pipeline extension ThrowOnSkippedMessages().

It does what I want: now MassTransit does not send messages (that are being retried) to the skipped queue.

But I can't say I completely understand what's happening there.

Upvotes: 0

Related Questions