Sure,
Controller
[HttpGet]
[Route("by-dateTime/{utcDateTime}")]
public async Task<RecordDto> GetRecordByDateTime(DateTime utcDateTime)
{
return await _recordAppService.GetRecordByDateTime(utcDateTime);
}
Application service
public async Task<RecordDto> GetRecordByDateTime([DisableDateTimeNormalization] DateTime utcDateTime)
{
var record = await _recordRepository.GetAsync(i => i.UtcDateTime == utcDateTime);
return await ObjectMapper.Map<RecordDto>(record);
}
Microservice A gets call of url path /api/records/by-dateTime/27/12/2021 10:00:00
. The format of date time is default format in InvariantCulture used by HttpClient.
But the issue relates not only to DateTime. It relates to any object which has special symbols in string presentation. For example, if we replace DateTime with string parameter, which value has space symbol inside, then we get problem again, because space can not be used without encoding in url path.
Hi
I have issue with GET endpoint which accepts DateTime as parameter. I have microservices 2 A and B. The endpoint is implemented by A and called by B. For calling I use dynamic HttpApiClient. When DateTime passed to http client as parameter, the DateTime is stringified to string with ToString method. Then the string passed to url parameters pasrt without encoded to url format. That leads, when DaeTime stringified to 'dd/MM/yy hh:mm:ss' format, endpoint is not found because dd MM and yy are parsed as segments of url path.
Is that a bug in http client? I checked ClientProxyUrlBuilder and I think that it should use HttpUtility.UrlEncode for every passed value.ToString() - snippet
Some details and rephrasing... The job is placed in application level of module A. The job uses app service from module B. In monotlith, app service interface is resolved to app service, which provided by B. If service has auth protection then job gets error. I would like to apply some workaround... implement internal version of service in B, which will not be exposed to controllers. Internal service implements the same interface (eg IBookAppService). Then, I would like internal version of service injected in monolith deployment. But in microservices deployment client proxy should be injected
Thus, we have 3 implementations of app service interface
@gterdem Thank yor for reply. But my question is about how to make Background Worker of module A to pull data from module B in way that will work in monolith and microservice deployments
Hi,
We are developing systems which consists of several Modules. We faced with some troubles in managing of communication between them. Right now, we have only monolith deployment. That means all our Modules are referenced by single ABP Host Application (which generated by ABP Suite). We referenced all Modules accordingly architecure of layers
Application -> Application Contracts -> Contracts ...
in Host Application. We have Module A which needs to coomunicate with Module B.
Actually both ways work. The reasl reason is ABP comes with not default languages included into supported cultures. You need to add them into AbpLocalization yourself
I need to get language which passed via Accept-language header to endpoint. In aspbloilerplate I used Thread.CurrentThread.CurrentUICulture
. In abp it does not look working.
What way I need to apply?
I am trying to run service for MSA solution. Service can not start with messages in log
[15:26:22 ERR] ABP-LIC-0008 - License check failed for 'Volo.Saas.Domain-v4.4.0.0'.
You need to log in using the command `abp login <username>`.
For more information, contact to license@abp.io.
[15:26:25 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Application, code=200, text='Connection close forced', classId=0, methodId=0
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Application, code=200, text='Connection close forced', classId=0, methodId=0
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at RabbitMQ.Client.IModelExensions.QueueDeclare(IModel model, String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:26:25 INF] Application is shutting down...
[15:26:25 INF] Initialized all ABP modules.
[15:26:25 FTL] Unable to start Kestrel.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
Why it is asking to log in into abp, whne license key is provided actually?
I need t configure DB context to use this library https://github.com/VahidN/EFCoreSecondLevelCacheInterceptor
How I can do that in ABP?
The code below is used to enable this interceptor
public static class MsSqlServiceCollectionExtensions
{
public static IServiceCollection AddConfiguredMsSqlDbContext(this IServiceCollection services, string connectionString)
{
services.AddDbContextPool<ApplicationDbContext>((serviceProvider, optionsBuilder) =>
optionsBuilder
.UseSqlServer(
connectionString,
sqlServerOptionsBuilder =>
{
sqlServerOptionsBuilder
.CommandTimeout((int)TimeSpan.FromMinutes(3).TotalSeconds)
.EnableRetryOnFailure()
.MigrationsAssembly(typeof(MsSqlServiceCollectionExtensions).Assembly.FullName);
})
.AddInterceptors(serviceProvider.GetRequiredService<SecondLevelCacheInterceptor>()));
return services;
}
}
ABP Version: 4.3
Sure. The same as in endpoint. CurrentUser is materizled from JWT token which passed to event data or in appsettings
public class UserStatBackgroundJob : IAsyncBackgroundJob<Object>
{
private readonly IUserLookupService<AppUser> _userLookupService;
ICurrentUser _currentUser; <<--------
public UserStatBackgroundJob(IUserLookupService<AppUser> userLookupService, ICurrentUser currentUser)
{
_userLookupService = userLookupService;
_currentUser = currentUser <<-------
}
public async Task ExecuteAsync(Object args)
{
long userCount = await _userLookupService.GetCountAsync();
var userName = currentUser.Name; <<---------
//usage of userCount
}
}