Activités de "Denis"

Ok. I will close this question

Please read carefully what I wrote above. My background job in module A needs to get some data from module B. For example - user amount. How can I move Identity module GetUserCount endpoint logic into domain service of module where background job is implemented?

Sure. There is simple example of BackgroundJob in my module

public class UserStatBackgroundJob : IAsyncBackgroundJob<Object>
        {
            private readonly IUserLookupService<AppUser> _userLookupService;

            public UserStatBackgroundJob(IUserLookupService<AppUser> userLookupService)
            {
                _userLookupService = userLookupService;
            }

            public async Task ExecuteAsync(Object args)
            {
                long userCount = await _userLookupService.GetCountAsync();

                //usage of userCount
            }
        }

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.

Affichage de 11 à 20 sur 31 entrées
Made with ❤️ on ABP v8.2.0-preview Updated on mars 25, 2024, 15:11