Activities of "Denis"

Hi Alper,

I already resolved the issue by adding RabbitMQ. Now, all events are sent to broker and them return back application. But now I have issue with authorization. Event handler needs to call application sevices, which are protected by authorization.

How I can do authorization with JWT token which passed to event data?

Hi

I have issue with distributed event handlers. I am using monoltih deloyment with RabbitMQ enabled. If event handler tryes to call application service, which have authorization attribute enabled, then it gets AbpAuthorizationException.

How this issue can be resolved in ABP?

  • ABP Framework version: v4.3rc1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi

I have several modules and one of them (A) sends distirbuted event. Another module (B) listening for this event. When modules are deployed in monolith I get endpojnt in module A, which sends the event, finished only after when distributed event processed by module B, because in monolith DIstributed Event Bus works as Local Event bus. I would like to know what option ABP framework can suggest to make distirbuted events processed asynchronously?

  • ABP Framework version: v4.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi liangshiwei,

It does not make sense to share code because we are talking about architecture. And I can not share code btw. I explained anough in topic, on my opinion.

There are 2 modules in monolith app. Module A makes several endpoint calls of module B. It is obvious that this calls share one UoW by default. There can be problems with that because every endpoint in B does take in account it will be called in same UoW with another endpoint

So question is how to make calling of endpoints of module B isolated, like module be is running in own microservice.

Hi liangshiwei,

Module A uses module B. And events will not help because they will be running in same UoW. Please help me to resolve question in topic

Hi

I have issue with modular architecture. My solution consist of multiple modules which calledl as A, B, C All modules are included in monolith application. All of them share same data base.

The problem occurs when endpoint (Application service method) in module A calls Application Service methods in module B Endpoint in module A needs to create couple aggregates in module B, for that it calls

B_app_service_1.CreateB1(data) B_app_service_2.CreateB2(data)

That happens that both methods track same entity. In other words one entity is tracked twice in one UoW and EF core can not perform changes in db If my modules would running as microservices, that would not happen because calls above would be isolated.

My question is how to avoid this situtaion in monotlith deployment? As I know I can force saving changes on endpoint of module A, but that is bad workaround on my opinion. Also I know that UoW is ambient and wrapping of module B application services calls will not help (that is still workaround)

Thanks

  • ABP Framework version: v4.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Separate
  • Exception message and stack trace:
  • Steps to reproduce the issue:

I would like to suggest remote session via TeamViewer or any other tool. I will show the issue. What do you think?

Hi @maliming

Do you mean the project I currently working on? if yes, unfortunatly I can not But I could create sample project which repoduces this issue. I think it will be also easy for you

Steps

  1. Create module project
  2. Create entity with string Title property
  3. Add method SetTile which assigns Title on entity construction and fires local TitleCreated event
  4. Create TitleCreated event handler and make it throw excpetion
  5. Create application service with endpoint which creates Product in memory and saves it via repo. Create controller as well
  6. Create Application project
  7. Reference module in Application
  8. Run application and call endpoint

Sure

2021-02-24 13:27:47.941 +00:00 [INF] Route matched with {area = "ProductManagement", controller = "Product", action = "CreateProduct", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[LinkSE.ProductManagement.Products.ProductDto] CreateProduct(LinkSE.ProductManagement.Products.ProductCreateDto) on controller LinkSE.ProductManagement.Controllers.Products.ProductController (LinkSE.ProductManagement.HttpApi).
2021-02-24 13:27:47.973 +00:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:a94ba6dc-a8f8-ae4f-fa5c-39faa9bfec06,n:ProductManagement.Products.Create
2021-02-24 13:27:47.974 +00:00 [DBG] Found in the cache: pn:U,pk:a94ba6dc-a8f8-ae4f-fa5c-39faa9bfec06,n:ProductManagement.Products.Create
2021-02-24 13:27:47.974 +00:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:ProductManagement.Products.Create
2021-02-24 13:27:47.974 +00:00 [DBG] Found in the cache: pn:R,pk:admin,n:ProductManagement.Products.Create
2021-02-24 13:27:47.974 +00:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:a94ba6dc-a8f8-ae4f-fa5c-39faa9bfec06,n:ProductManagement.Products
2021-02-24 13:27:47.974 +00:00 [DBG] Found in the cache: pn:U,pk:a94ba6dc-a8f8-ae4f-fa5c-39faa9bfec06,n:ProductManagement.Products
2021-02-24 13:27:47.975 +00:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:ProductManagement.Products
2021-02-24 13:27:47.975 +00:00 [DBG] Found in the cache: pn:R,pk:admin,n:ProductManagement.Products
2021-02-24 13:27:47.975 +00:00 [INF] Authorization was successful.
2021-02-24 13:27:48.023 +00:00 [DBG] Added 0 entity changes to the current audit log
2021-02-24 13:27:48.024 +00:00 [DBG] Added 0 entity changes to the current audit log
2021-02-24 13:27:48.025 +00:00 [INF] Executing ObjectResult, writing value of type 'LinkSE.ProductManagement.Products.ProductDto'.
2021-02-24 13:27:48.025 +00:00 [INF] Executed action LinkSE.ProductManagement.Controllers.Products.ProductController.CreateProduct (LinkSE.ProductManagement.HttpApi) in 84.2536ms
2021-02-24 13:27:48.026 +00:00 [INF] Executed endpoint 'LinkSE.ProductManagement.Controllers.Products.ProductController.CreateProduct (LinkSE.ProductManagement.HttpApi)'
2021-02-24 13:27:48.114 +00:00 [DBG] Added 0 entity changes to the current audit log
2021-02-24 13:27:48.114 +00:00 [DBG] Added 0 entity changes to the current audit log
2021-02-24 13:27:48.180 +00:00 [WRN] An exception occurred, but response has already started!
2021-02-24 13:27:48.180 +00:00 [ERR] An unhandled exception has occurred while executing the request.
LinkSE.Common.Exceptions.AlreadyExistException: Exception of type 'LinkSE.Common.Exceptions.AlreadyExistException' was thrown.
   at LinkSE.ProductManagement.Products.EventHandlers.ProductEventHandler.HandleEventAsync(ProductCodeAddingEvent eventData)
   at Volo.Abp.EventBus.EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List`1 exceptions)
   at Volo.Abp.EventBus.Local.LocalEventBus.PublishAsync(Type eventType, Object eventData)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerLocalEvents(List`1 localEvents)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerEventsInternalAsync(EntityChangeReport changeReport)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerEventsAsync(EntityChangeReport changeReport)
   at Volo.Abp.EntityFrameworkCore.AbpDbContext`1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
   at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2021-02-24 13:27:48.180 +00:00 [WRN] The response has already started, the error handler will not be executed.
2021-02-24 13:27:48.181 +00:00 [ERR] Connection id "0HM6O5GA1U0OV", Request id "0HM6O5GA1U0OV:00000002": An unhandled exception was thrown by the application.
LinkSE.Common.Exceptions.AlreadyExistException: Exception of type 'LinkSE.Common.Exceptions.AlreadyExistException' was thrown.
   at LinkSE.ProductManagement.Products.EventHandlers.ProductEventHandler.HandleEventAsync(ProductCodeAddingEvent eventData)
   at Volo.Abp.EventBus.EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List`1 exceptions)
   at Volo.Abp.EventBus.Local.LocalEventBus.PublishAsync(Type eventType, Object eventData)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerLocalEvents(List`1 localEvents)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerEventsInternalAsync(EntityChangeReport changeReport)
   at Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper.TriggerEventsAsync(EntityChangeReport changeReport)
   at Volo.Abp.EntityFrameworkCore.AbpDbContext`1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
   at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2021-02-24 13:27:48.181 +00:00 [INF] Request finished HTTP/1.0 POST https://api.linkse.dev/api/product-management/products application/json 104 - 200 - application/json;+charset=utf-8 254.6321ms

Hi

Actually before removal of http client lib asll wroked, and after removal endpoints work too. Why I need to remove this libs when ABP Commecrcial modules http client libs are referenced by application?

Showing 21 to 30 of 42 entries
Made with ❤️ on ABP v9.1.0-rc.1. Updated on January 17, 2025, 14:13