Open Closed

Distributed Event Bus Entity Synchronizer #8974


User avatar
0
maharatha@gmail.com created

I am trying to use the Pre Defined Events for Entity following this link : https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed?_redirected=B8ABF606AA1BDF5C629883DF1061649A#pre-defined-events.

I tried this code in the file management module :


 ConfigureDistributedEntityEvent();
 
 private void ConfigureDistributedEntityEvent()
 {
     Configure(options =>
     {
        
         options.AutoEventSelectors.AddAll();
       
     });
 }

My expectation was the message should start showing up in the Eventoutbox table whenevver I add a file or delete a file.

However I get some exception which doesn't appear either on Log file or Audit log or anywhere. But when I comment the code everything works fine.

Is there any other settings I have to make to see the messages in the eventbox.

Note : I am not asking about Synchronizing yet as the first step is to be able to see the meesges in the outbox.


4 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
    maharatha@gmail.com created

    I am using Microservices Template and and I have not made any changes to any default settings. So whatever comes from you guys thats' the settings.

    This is the stack trace when RabbitMQ is properly configured in Appsettings:

    at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at Microsoft.Data.SqlClient.SqlCommand.InternalEndExecuteNonQuery(IAsyncResult asyncResult, Boolean isInternal, String endMethod)
       at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
       at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryAsync(IAsyncResult asyncResult)
       at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
    --- End of stack trace from previous location ---
       at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
       at Volo.Abp.EntityFrameworkCore.DistributedEvents.DbContextEventOutbox`1.DeleteManyAsync(IEnumerable`1 ids)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Volo.Abp.EventBus.Distributed.OutboxSender.PublishOutgoingMessagesInBatchAsync(List`1 waitingEvents)
       at Volo.Abp.EventBus.Distributed.OutboxSender.RunAsync()
       at Volo.Abp.EventBus.Distributed.OutboxSender.RunAsync()
       at Volo.Abp.EventBus.Distributed.OutboxSender.TimerOnElapsed(AbpAsyncTimer arg)
       at Volo.Abp.Threading.AbpAsyncTimer.Timer_Elapsed()
    

    All database connections are fine as well, and this error only appears when I turn on Distributed event for entities.

    And below is the stack trace when i make changes to AppSettings for Rabbit MQ :

    at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
       at RabbitMQ.Client.ConnectionFactory.CreateConnection(String clientProvidedName)
       at RabbitMQ.Client.ConnectionFactory.CreateConnection()
       at Volo.Abp.RabbitMQ.ConnectionPool.<>c__DisplayClass8_0.<Get>b__1()
       at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
       at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
       at System.Lazy`1.CreateValue()
       at Volo.Abp.RabbitMQ.ConnectionPool.Get(String connectionName)
       at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
    
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi,

    First of all, thank you for your detailed information. It seems that it cannot connect to RabbitMQ. Can you send your project to berkan.sasmaz@volosoft.com so that I can reproduce the problem?

  • User Avatar
    0
    maharatha@gmail.com created

    I sent you the code, and its only for filemanagement thats where I have been trying to test

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 18, 2025, 10:42