Activities of "Denis"

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

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?

Hi @maliming

I have several modules which were inteded to wrok as microservices. These modules communicates with each other using Http API. But now I want put all modules in one application. My question is how to configure application that modules would get injected application services instead of http proxies, which provided by modules in application assembly?

@liangshiwei Thanks

I agree with you and I would not want to reference domain of another module. I just looking for best way and figure out that my design of modules is just wrong

Yes, thanks you!

@liangshiwei thanks for your reply. It is I looked for

Sorry, but it does not look you answered on my questions. Maybe I understand that wrong. Can you please explain the way how to use 2 modules communicating with each other in monolith and use them again but as microservices (2 solutions using same modules: one as monolith, another one as microservices)? It is clear how modules communicate with each other in microservices - via API and events. But it is not clear how I can use same module (eg blogging module) in monolith. Should communication with built in module still be performed via API (monolith app accessing itself via network)?

Maybe you have some sample project for the monolith best practice? It will help a lot.

Showing 21 to 30 of 31 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11