0
mariovh created
ABP Framework version: v7.4.4 UI Type: Blazor WASM Database System: EF Core (SQL Server)
Hi, Im using Abp AzureDistributedEventBus, with outbox and inbox pattern, and i need to update IncomingEventInfo ExtraProperties when I MarkAsProcessedAsync. Here is my code:
internal async Task IncomingEventInfoMarkAsProcessed(IncomingEventInfo incomingEvent, InboxConfig inboxConfig)
{
if (AbpDistributedEventBusOptions.Inboxes.Count <= 0)
{
return;
}
using var scope = ServiceScopeFactory.CreateScope();
var eventInbox = (IEventInbox)scope.ServiceProvider.GetRequiredService(inboxConfig.ImplementationType);
if (incomingEvent.MessageId.IsNullOrEmpty())
{
return;
}
if (!Guid.TryParse(incomingEvent.MessageId, out var messageId))
{
return;
}
if (!await eventInbox.ExistsByMessageIdAsync(incomingEvent.MessageId))
{
return;
}
incomingEvent.ExtraProperties.Add("ERROR COUNT", 1);
// UPDATE DE EXTRA PROPERTIES
await eventInbox.MarkAsProcessedAsync(messageId);
}
1 Answer(s)
-
0
Hi,
there is no
IncomingEventInfo
entity. You may want to update theIncomingEventRecord
You can try:
protected IDbContextProvider<YourDbContext> DbContextProvider { get; } internal async Task IncomingEventInfoMarkAsProcessed(IncomingEventInfo incomingEvent, InboxConfig inboxConfig) { ..... var dbContext = await DbContextProvider.GetDbContextAsync(); await dbContext.IncomingEvents.Where(x => x.Id == messageId).ExecuteUpdateAsync(....); await eventInbox.MarkAsProcessedAsync(messageId); }