[EventBus/Rebus] Retry logic not applied when using ABP Distributed EventBus with Inbox
Description
I am using ABP 9.3.2 with Rebus integration. I’ve configured the Distributed EventBus with Rebus retry strategy. The issue is that:
When I configure inside PreConfigure<AbpRebusEventBusOptions> along with options.Inboxes.Clear(); inside ConfigureServices() , messages are retried but no entries are persisted in AbpEventInbox.
When I configure inside PreConfigure<AbpDistributedEventBusOptions> along with
options.Inboxes.Configure("Default", inbox => { inbox.IsProcessingEnabled = true; }); in ConfigureServices() , events are saved in AbpEventInbox, but retry logic is not applied and the same failing message is processed again and again (always with Processed = 0).
If I disable inbox.IsProcessingEnabled, the events stay in the inbox table but no handler is triggered.
Expected behavior:
1- Events stay in the inbox table and so that I can make sure that the event are handled idempotency 2- Retries should happen (with the configured retry strategy). 3- Failing messages should eventually end up in the error queue. 4- Inbox entries should reflect retry attempts correctly.
Sample Code:
Include just the configuration snippets:
PreConfigure<AbpRebusEventBusOptions>(options => { options.InputQueueName = "AbpRebusDemoQueue"; options.Configurer = rebus => { rebus.Logging(l => l.ColoredConsole(LogLevel.Debug)); rebus.Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "AbpRebusDemoQueue"));
var rebusOptions = configuration.GetSection("Rebus:Options").Get<RebusOptions>();
if (rebusOptions != null)
{
rebus.Options(o =>
{
o.RetryStrategy(rebusOptions.ErrorQueue, rebusOptions.MaxDeliveryAttempts);
o.SetNumberOfWorkers(1);
o.SetMaxParallelism(1);
});
}
};
});
Configure<AbpDistributedEventBusOptions>(options => { options.Inboxes.Clear(); //options.Inboxes.Configure("Default", inbox => //{ // inbox.IsProcessingEnabled = true; //}); options.Outboxes.Configure("Default", outbox => { outbox.IsSendingEnabled = true; }); });
Environment:
ABP version: 9.3.2
.NET version: .NET 9
Transport: Rebus InMemory (for sample), RabbitMQ (real case)
Database: SQL Server
Steps to Reproduce:
Clone the attached sample repo (provide a link).
Run migrations to create AbpEventInbox and AbpEventOutbox.
Run the solution.
Trigger the sample OrderCreatedEto event under OrderAppService via swagger.
Observe that retries and inbox behavior do not align.
hi
Please share a template project to reproduce the problem.
Please check the below repo link of a template ABP project. which contains the configuration i did. https://github.com/muqaddemmaqsood/EventBusSample
@maliming
hi
What are the steps?
Hi @maliming Below are the steps:
Clone the attached sample repo (provide a link).
Run migrations to create AbpEventInbox and AbpEventOutbox.
Run the solution.
Trigger the sample OrderCreatedEto event under OrderAppService via swagger.
Observe that retries and inbox behavior do not align.
Hi @maliming any update ?