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<AbpDistributedEntityEventOptions>(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.
16 Answer(s)
-
0
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.
-
-
0
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()
-
0
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?
-
0
I sent you the code, and its only for filemanagement thats where I have been trying to test
-
0
Hello,
I reviewed the code you sent. There does not seem to be a problem in the code, but I also get the error you get about not being able to connect to the database. The reason for this error is that the FileManagement service also needs access to the database of the LanguageManagement service. For this reason, if you want to start the FileManagement service on its own, you need to start the other services first. If you want to learn more about microservice application development, you can follow this tutorial. -
0
I do understand how to develop the micro services. I just sent you the file management services because the rest were too big to send. As mentioned earlier above I don't get any kind of error if I remove the code to event options.AutoEventSelectors.AddAll().
You can easily create a Microservice solution using abp studio and test this out without the need for me sending any code as I am using all the default settings.
-
0
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
-
0
I think you don't understand my issue properly. My issue is the transaction is not getting completed the moment I turn on
options.AutoEventSelectors.AddAll();I enabled this option in 2 Modules one the FileManagement Module which comes default and I enabled in the Second Module AI Service.
I also used config.IsSendingEnabled = false for the filemanagement module and tested.
Bheavior in FileManagementModule :
The records are getting inserted in the EvenOutBox but the file is not getting uploaded, it throws error. The moment I comment the AutoEventSelector everything works fine
Behavior in AI Service Module :
No record gets inserted in the eventoutbox when the AutoEventSelector is on, if its commented out everything works fine.
I am not too concerned about the subscriber to these events, first I want to make sure the events are getting published properly as per the documentation which clearly is not happening.
I have sent you the entire code base to your email , so please feel free to debug and test and let me know. Lets resolve this matter today, I can't be going back and forth and wait for another 24 hours to get a response.
-
0
Can I get some response to this issue?
-
0
Sorry for the late reply. I will try to check your solution later today.
-
0
Did you check ?
-
0
hi
Can you try to change the following properties of
AbpEventBusBoxesOptions
and try again?You can configure
AbpEventBusBoxesOptions
in all of the microservices.public override void ConfigureServices(ServiceConfigurationContext context) { Configure<AbpEventBusBoxesOptions>(options => { options.InboxWaitingEventMaxCount = 100; //Default 1000 options.OutboxWaitingEventMaxCount = 100; //Default 1000 options.BatchPublishOutboxEvents = false; //Default true }); }
If you get new exceptions, you can share them here.
Thanks.
-
0
@maliming There is no improvement. I am also now not able to catch the exception or see it in AbpStudio. The things you asked me to try is to basically control the flow of event into the outbox. When I upload a file I see several messages going into outbox and getting deleted , I assume that's behaviour is normal, buit not sure why so many similar events gets inserted.
BUT the problem is the transaction or file upload is never a success.
I have been going back and forth on this issue as well this has been my experience off late with the support. I gave my entire code base and I am not doing anything different that you or your team couldn't do it to replicate the issue. I am always been asked to try it from my end, but it would be very helpful and fast if you guys can create a new microservice solution and just add a single line of code to enable the feature and test it.
Literally it doesn't take more than 10-15 mins for someone at your end to test and clarify if its working at your end. This issue is open since last 10 days. I need a better and faster resolution to my problems. -
0
hi
I created a new MS project for troubleshooting.
options.AutoEventSelectors.AddAll();
will have a problem. I tested the code below, and it works.We will fix
AddAll
problem in https://github.com/abpframework/abp/pull/22471Configure<AbpDistributedEntityEventOptions>(options => { options.AutoEventSelectors.Add<DirectoryDescriptor>(); options.AutoEventSelectors.Add<FileDescriptor>(); });
-
0
Thank You @maliming. My whole issue was around the fact that options.AutoEventSelectors.AddAll(); is causing the issue.
I tested with explicit entity names and it works.
Do we know why it doesn't work, is it a bug that needs to be fixed ?
If someone would have tested when I reported this, we wouldn't have spent time going back and forth on this issue.
I am an user from the early days of ASPNET Zero and have been using your products since the beginning of time.As your company is growing the quality and time of resolution is going downhill and its causing massive issue for users like me who have to wait for 10 days to get an answer. The same or worse happened to me when I reported an issue about proxy generation in Angular and it turned out of you have a project name with 2 consecutive caps block it breaks it.
I hope you take this to your seniors and share this feedback.
-
0
hi
I will fix
AddAll
in https://github.com/abpframework/abp/pull/22471#issue-2951431686if
options.AutoEventSelectors.AddAll();
Configure<AbpDistributedEntityEventOptions>(options => { options.AutoEventSelectors.AddAll(); });
1️⃣ Add an entity
↓
2️⃣ PublishEntityCreatedEto<MyEntity>
event
↓
3️⃣ Add to Outbox and insertOutgoingEventRecord
entity
↓
4️⃣ PublishEntityCreatedEto<OutgoingEventRecord>
event
↓
↻ Back to 3️⃣
↓
Endless loop