Open Closed

No records are inserted into EventBox table #8971


User avatar
0
logix.technology created

I publish a distributed event bus with transactional event in/outbox pattern
I configure the event inbox and outbox the same the documentation into my dbcontext

Problems: No records are inserted into the EventBox table, but the event handler still receives the event notification.

When I produce a message from the UI to Apache Kafka, my service successfully consumes the message and inserts it into the EventInbox table.
However, when my service publishes a message, it is not inserted into the EventOutbox table. Despite this, other services are still able to consume the message from Kafka.

Expected Behavior:
Messages produced by my service should be recorded in the EventOutbox table before being published to Kafka.

Observed Behavior:
The message is successfully published and consumed by other services.
However, the EventOutbox table does not contain the published message

  • ABP Framework version: v9.0.2

  • UI Type: Blazor Server

  • Database System: EF Core (PostgreSQL)

  • Tiered (for MVC) or Auth Server Separated (for Angular): no

  • Exception message and full stack trace: N/A

  • Steps to reproduce the issue: Publish a distributed event bus


9 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello,

    I need additional information to understand your problem more clearly. For example, which distributed eventbus provider are you using?

    Here are the providers:

    • LocalDistributedEventBus is the default implementation that implements the distributed event bus to work as in-process. Yes! The default implementation works just like the local event bus, if you don't configure a real distributed provider.

    • AzureDistributedEventBus implements the distributed event bus with the Azure Service Bus. See the Azure Service Bus integration document to learn how to configure it.

    • RabbitMqDistributedEventBus implements the distributed event bus with the RabbitMQ. See the RabbitMQ integration document to learn how to configure it.

    • KafkaDistributedEventBus implements the distributed event bus with the Kafka. See the Kafka integration document to learn how to configure it.

    • RebusDistributedEventBus implements the distributed event bus with the Rebus. See the Rebus integration document to learn how to configure it.

  • User Avatar
    0
    logix.technology created

    Hello,

    I using KafkaDistributedEventBus to implemets the distributed event bus with Kafka
    And enable inbox/outbox pattern

    In HttpApi.Host layer and configuration in appsettings.json

    [DependsOn(
        typeof(AbpDistributedLockingModule),
        typeof(AbpEventBusKafkaModule),
        typeof(AbpCachingStackExchangeRedisModule),
        )]
    

    In the EntityFrameworkCore layer, my db context inherits IHasEventInbox and IHasEventOutbox interface

    Configure(options =>
    {
    	options.Inboxes.Configure(XXXServiceDbContext.DatabaseName, config =>
    	{
    		config.UseDbContext();
    	});
    
    	options.Outboxes.Configure(XXXServiceDbContext.DatabaseName, config =>
    	{
    		config.UseDbContext();
    	});
    });
    

    When I produce a message from the UI to Apache Kafka, my service successfully consumes the message and inserts it into the EventInbox table.
    However, when my service publishes a message, it is not inserted into the EventOutbox table. Despite this, other services are still able to consume the message from Kafka.
    Expected Behavior:

    • Messages produced by my service should be recorded in the EventOutbox table before being published to Kafka.

    Observed Behavior:

    • The message is successfully published and consumed by other services.

    • However, the EventOutbox table does not contain the published message

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi,

    Records are deleted after they are published to the event bus. However, if you want to test this, you can test it by setting send to false as below:

    Configure<AbpDistributedEventBusOptions>(options =>
    {
        options.Outboxes.Configure(config =>
        {
            // IsSendingEnabled (default: true): You can set to false to disable sending outbox events to the actual event bus. If you disable this, events can still be added to outbox, but not sent. This can be helpful if you have multiple applications (or application instances) writing to outbox, but use one of them to send the events.
            config.IsSendingEnabled = false
        });
    });
    
    

    reference: https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed#outbox-configuration

  • User Avatar
    0
    logix.technology created

    Thansk for your support, I disabled sending flag and the event added to outbox, but not sent to event bus

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Records are deleted after they are published to the event bus. However, if you want to test this, you can test it by setting send to false as below:

    This is expected behavior. We disable IsSendingEnabled to show that data is actually written to the Outbox table. Because when the event is published, the record is deleted from the Outbox table and you cannot see it when this process happens very quickly.

    Screenshot 2025-03-20 at 13.12.07.png

  • User Avatar
    0
    logix.technology created

    I created a trigger to track the records inserted into the Outbox table. If any records are inserted into the Outbox table, the trigger should insert a record into the AuditOutbox table. However, it does not insert records into either the Outbox or AuditOutbox table when an event is published.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi,

    Can you send your application to berkan.sasmaz@volosoft.com so I can reproduce your problem?

  • User Avatar
    0
    logix.technology created

    Hello,
    My mistake - I configured the event inbox/outbox in EF Core for the administration and shared it in XXX.Shared.Hosting.Microservice, and my SaaS service is also under the administration service.

    However, the outbox was inserted into the administration service instead of the SaaS service.
    Solution: I moved the configuration from EF Core to the HttpApi.Host project and it's working inserted into outbox table and deleted after publish an event

    I will close this issue
    Thanks for your support

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    I'm glad to hear that :)

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 25, 2025, 11:10