Activities of "Denis"

Yes, I did that. I disbaled UoW via attribute and created UoW for each call of endpoints of other module

I have similar issue. I have 2 modules A and B. Module A has Background Job which calls endpoint in module B. Background Job gets exception AbpAuthoizationException because endpoint is protected with permission

My qestions about that https://support.abp.io/QA/Questions/1364/Authorization-in-event-handlers https://support.abp.io/QA/Questions/1347/Distributed-Events-in-monolith

hi

Don't call application service in event handler. You can call the domain service that without the Authorization.

I can not move Application Service logic into Domain Service because endpoint is implemented by another Module. Event Handler in module A pulls some data from module B using its endpoint

There is also one more example with background jobs. For example I need periodical background job which creates stats about users created passed period. Background Job needs to make endpoint call to Idenity module, but it will not able to do that due it is not authorized

So question is how to make authorization prodecure in same way as that done in middleware when endpointcalled?

why do you need authorization? extract the running code part from AppService and move it to a DomainService. then call the domain service method in your handler. And also use it in your AppService as well.

I need authorization because domain make calls to endpoints of another module. I can not move logic of endpoint in module B to domain of module A, which calls endpoint.

For instance, domain may call GET User endpoint in Identity module to get Name of user and use it in own purporse

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 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

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
Showing 11 to 20 of 28 entries
Made with ❤️ on ABP v9.1.0-rc.1. Updated on January 17, 2025, 14:13