I am using the Microservice template. I want to get the current user's roles id and organization id in my product microservice.
Thanks
I can get the settings value by ISettingStore but how can I update the setting value from another microservice because ISettingManager is not available.
Any update on this?
I have microservice architecture. I have create new setting provider in administration microservice.
Custom Setting Definition Provider
public class CustomSettingDefinitionProvider : SettingDefinitionProvider, ITransientDependency
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(new SettingDefinition("TotalRank", ""));
}
}
Custom Setting Management Provider
public class CustomSettingManagementProvider : SettingManagementProvider, ITransientDependency
{
public override string Name => "W";
public CustomSettingManagementProvider(ISettingManagementStore store)
: base(store)
{
}
}
Custom Setting Value Provider
public class CustomSettingValueProvider : SettingValueProvider
{
public override string Name => "W";
public CustomSettingValueProvider(ISettingStore settingStore)
: base(settingStore)
{
}
public override Task<string> GetOrNullAsync(SettingDefinition setting)
{
return SettingStore.GetOrNullAsync(setting.Name, Name, null);
}
public override Task<List<SettingValue>> GetAllAsync(SettingDefinition[] settings)
{
return SettingStore.GetAllAsync(settings.Select(x => x.Name).ToArray(), Name, null);
}
}
I have registered custom setting definition and provider in AdministrationServiceApplicationModule
Configure<AbpSettingOptions>(options =>
{
options.DefinitionProviders.Add<CustomSettingDefinitionProvider>();
});
Configure<SettingManagementOptions>(options =>
{
options.Providers.Add<CustomSettingManagementProvider>();
});
I can add the settings by above configuration in database.
Now, I want to read the custom setting in another microservice so I have created custom setting value provider in my another microservice and I registered value provider in app module.
public class CustomSettingValueProvider : SettingValueProvider
{
public override string Name => "W";
public CustomSettingValueProvider(ISettingStore settingStore)
: base(settingStore)
{
}
public override Task<string> GetOrNullAsync(SettingDefinition setting)
{
return SettingStore.GetOrNullAsync(setting.Name, Name, null);
}
public override Task<List<SettingValue>> GetAllAsync(SettingDefinition[] settings)
{
return SettingStore.GetAllAsync(settings.Select(v => v.Name).ToArray(), Name, null);
}
}
Configure<AbpSettingOptions>(options =>
{
options.ValueProviders.Add<CustomSettingValueProvider>();
});
When I read the custom setting, it giving the null value.
var setting = await _customSettingValueProvider.GetOrNullAsync(new SettingDefinition("TotalRank")) ;
I also check with provider key but it always return null value.
I have already read the setting provider document and its not giving any details for microservice architecture to read the custom setting provider from another application.
I have implemented the custom http error handler as below and registered in app module class.
export function handleHttpErrors(injector: Injector, httpError: HttpErrorResponse) {
const toaster = injector.get(ToasterService);
if (httpError.status === 403 || httpError.status === 400) {
toaster.error(httpError.error?.error?.message || 'Error');
return;
}
return throwError(httpError);
}
providers: [{ provide: HTTP_ERROR_HANDLER, useValue: handleHttpErrors },.............]
The toaster message is displaying but dialog is also appearing.
I have azure service handler and I am creating the entity through AppService but I am getting the unauthorize permission issue.
[UnitOfWork]
public async Task HandleEventAsync(ArticleDownCreationEto articleDownCreationEto)
{
await _articleDownsAppService.CreateAsync(articleDownCreationEto);
}
I am getting below exception:
[integration-service_8e3ac652-7]: [15:59:52 INF] Authorization failed. These requirements were not met: [integration-service_8e3ac652-7]: PermissionRequirement: IntegrationService.ArticleDowns
I have a Microservice architecture and all microservices has the azure service bus configuration.
I am publishing the event from Microservice 1 and receiving in Microservice 2 and again publishing the event from Microservice 2 and receiving in Microservice 3.
But When I publish the event from Microservice 1, its not aways receiving in Microservice 2. Sometimes its receiving and publishing to Microservice 3.
I have also checked the Service Bus in azure portal and there is no active message once I publish the event from Microservice 1 means the event is subscribe by other subscription but not by Microservice 2. I have written receiving handler in Microservice 2 so only Microservice 2 should subscribe the event from Microservice 1.
Is there any way to specify the subscription name while publishing the data so only that subscriber can receive the event?
Shared ETOs
Publish event from Microservice 1
Receiving handler and publishing event in Microservice 2
Receiving handler in Microservice 3
The above links are not helpful, I am using the ABP framework 7.0.1 with microservice template and openIdDict, not identity server. I have updated the securitystamp on each login which should validate and invalidated the previous token.