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
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();
}
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
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.
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?
If a Micro Service has two controller, which implement separate AppService, For the [Area("...")], can these two controller use same value? There is a strange behavior right now, when call another MicroService method, the first time call it is fine, and second call failed complain that the remote service is not defined in RemoteService section? Any clue? "Remote service 'xxxxService' was not found and there is no default configuration.
With Micro-Service architecture which the distributed event bus is implemented by RabbitMQ. I have the following questions:
When Angular calls API which trigger a long operational call, the entrance App Service method has [UnitOfWork(IsDisabled = true)]. This App Service call several other App Services. Within these App Services there are several places need to access/update MongdoDb, for those data access, use code below:
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
...
await uow.CompleteAsync();
}
But still MongoDb throw exception. For these App Services Methods called by entrance App Service, do I need to add [UnitOfWork(IsDisabled = true)] annotation too? Thanks,
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1+<ExecuteAsync>d__20.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at MongoDB.Driver.Core.Servers.Server+ServerChannel+<ExecuteProtocolAsync>d__20`1.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor+<ExecuteAsync>d__3`1.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
...
at Volo.Abp.Auditing.AuditingInterceptor+<InterceptAsync>d__2.MoveNext (Volo.Abp.Auditing, Version=7.2.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=7.2.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral,
Do you have a sample code for SignalR send message to Angular app. Angular get 502 for negociate.
In Micro Service Application module: typeof(AbpAutoMapperModule),
Configure<AbpSignalROptions>(options =>
{
options.Hubs.AddOrUpdate(
typeof(NotificationHub), //Hub type
config => //Additional configuration
{
config.ConfigureActions.Add(hubOptions =>
{
//Additional options
hubOptions.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
});
}
);
});
In Gateway module:
app.UseWebSockets();
app.UseOcelot().Wait();
app.UseRouting()
{
"ServiceKey": "SignalR Service",
"DownstreamPathTemplate": "/signalr-hubs/{evertything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 45186
}
],
"UpstreamHttpMethod": [ "POST" ],
"UpstreamPathTemplate": "/signalr-hubs/{evertything}",
"ReRouteIsCaseSensitive": false
},
{
"ServiceKey": "SignalR Service",
"DownstreamPathTemplate": "/signalr-hubs/{everything}",
"ReRouteIsCaseSensitive": false,
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 45186
}
],
"UpstreamPathTemplate": "/signalr-hubs/{anyHub}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ]
},
After deployed the application (Micro-Service template) to Azure Kubernates, Choose an tennant from login screen, however the tennantId is null while inspect the network traffic from browser. Local works fine.
Do you have any clue about the reason?
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please use the search on the homepage.
If you're creating a bug/problem report, please include the followings: