Activities of "DominaTang"

Answer

It looks like use .InsertAysnc(entity,true) resolved the problem.

In Abp MicroSerivce projects, if an API call triggered by UI to MicroService A Method1, and Method1 call Method2 in MicroService B. In Method2, if access CurrentTenant property, would it get the same value in Method1? This is the TenantId, CurrentUser penetrate issue across micro-services.

Thanks

  • ABP Framework version: v7.3.2
  • UI Type: Angular / MVC / Blazor WASM / Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Answer

Inserted does return Id, line var dbData = repository.GetAsync(inserted.Id); throw exception, can not find entity with Id xxxxx in log, and that guid value is the Guid in MongoDb.

Question

With code below, at the second unit of work section, the line var dbData = repository.GetAsync(inserted.Id); throw exception, there is no Such Entity? Though if check database later, the new record is inserted into database successfully. Does Mongo driver cache the data somewhere?

[UnitOfWork(IsDisabled = true)]
public async Task SubmitAsync(XXXinput dto)
{
    using var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
   //Map dto to Domain entity
   var inserted = await repository.InsertAysnc(domainEntity);
    await uow.SaveChangesAsync();
    await uow.CompleteAsync();

   using var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
   var dbData =  repository.GetAsync(inserted.Id);
   //Other db operation
 await uow.SaveChangesAsync();
    await uow.CompleteAsync();
}
  • ABP Framework version: v7.2.3
  • UI Type: Angular / MVC / Blazor WASM / Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

After reading this document page, https://docs.abp.io/en/abp/latest/Distributed-Event-Bus I am confused about shall I add distributed lock for event handler. Scenario: The event hander is within a Micro Service and Deployed with two instances. Shall I add distributed lock in event handler so that to make sure one message only processed once? Like code below:

 public async Task HandleEventAsync(EntityDataSyncEto eto)
        {
            try
            {
                await using var handle = await _distributedLock.TryAcquireAsync("SyncEntityList");
                if (handle != null)
                {
                    _ = await _dataSyncAppService.ProcessEntity(eto);
                }
            }
            catch (Exception ex)
            {
                _logger.LogException(ex);
            }
        }

Then I noticed with above lock, if there are several messages coming almost at the same time, some messages are missed to process in the event handler. Thanks, Domina

  • ABP Framework version: v7.2.3
  • UI Type: Angular
  • Database System: EF Core/ MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes , Microservice

Hi,

I don't recommend you do this, I think this may be a usage issue.

If you are willing to provide detailed steps or projects I will try to help you.

Don't have time to prepare sample project code. I get rid of MongoDb side JobLog entity and related code only keep one Micro Service has JobLog entity. Then the duplicate log is gone.

I have another question, when an event bus - event handler subscribe to an event, if the handler code has exception, the message is kept in the queue and keep sending to handler again and again? Is there a setting to set up the max try times or if handler failed, don't keep the message in the queue. (RabbitMQ distributed event bus) (

Hi,

Could you provide the full steps or share a project to reproduce the problem? I will check it. my email is shiwei.liang@volosoft.com

How about disable Abp's auto route binding for a MicroService?

I tried the settings below, none of them works.

Configure<AbpDistributedEntityEventOptions>(options =>
{
   
    options.AutoEventSelectors.Clear();
   options.AutoEventSelectors.RemovelAll(x=>true);
  options.AutoEventSelectors.Remove<JobLog>();
}

I have two MicroSerives, both has an Entity Called "JobLog", and I defined a shared Eto called "JobLogEto". Then both MicroSerivces binds to this JobLogEto from RabbitMQ's exchange binding info. Within one Micro Service, there is a code subscribe to this JobLogEto, and then I noticed there are duplicate records generated, if I manually unbind the second Micro Service to this eto, then no duplicate records insert. Even in second Micro Service, I didn't subscribe to this Eto. The event are triggered twice.

  • ABP Framework version: v7.2.1 + Micro Service

I see some AppService has [IntegrationService] above the AppService. With this annotation, does it mean this AppService are only available called by other Micro Service and Angular UI code can not call this App Service?

  • ABP Framework version: v7.2.1 + MicroService

Thanks. So our controller code should be fine. Need to investigate why the second call failed, the code was working without problem before.

Showing 51 to 60 of 86 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13