I am not able to get Exceptions to be recorded by Elastic APM. It seems like Exception are handled by some other middleware and not released to Elastic middleware. I placed Use Elastic APM on the top of OnApplicationInitialization. That did not help. So far it seems only exceptions on EF core are caught by Elastic APM. I tested with general Exception thrown by me - even that Exception is not caught
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
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.
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
Hi
I have issue with distributed event handlers. I am using monoltih deloyment with RabbitMQ enabled. If event handler tryes to call application service, which have authorization attribute enabled, then it gets AbpAuthorizationException.
How this issue can be resolved in ABP?
Hi
I have several modules and one of them (A) sends distirbuted event. Another module (B) listening for this event. When modules are deployed in monolith I get endpojnt in module A, which sends the event, finished only after when distributed event processed by module B, because in monolith DIstributed Event Bus works as Local Event bus. I would like to know what option ABP framework can suggest to make distirbuted events processed asynchronously?
Hi
I have issue with modular architecture. My solution consist of multiple modules which calledl as A, B, C All modules are included in monolith application. All of them share same data base.
The problem occurs when endpoint (Application service method) in module A calls Application Service methods in module B Endpoint in module A needs to create couple aggregates in module B, for that it calls
B_app_service_1.CreateB1(data) B_app_service_2.CreateB2(data)
That happens that both methods track same entity. In other words one entity is tracked twice in one UoW and EF core can not perform changes in db If my modules would running as microservices, that would not happen because calls above would be isolated.
My question is how to avoid this situtaion in monotlith deployment? As I know I can force saving changes on endpoint of module A, but that is bad workaround on my opinion. Also I know that UoW is ambient and wrapping of module B application services calls will not help (that is still workaround)
Thanks
I created several modules using ABP suite. Every module provides API, does not have Web GUI. Also I have Application which generated by ABP Suite. I included my modules to application.
I run application and call endpoint of module. The endpoint returns OK result or ERR_INCOMPLETE_CHUNKED_ENCODING. But in the log I can find BusinessException expection which thrown during endpoint call. Also before this expection there is "An exception occurred, but response has already started
" message.
The expection is thrown in local event handler, which is triggered in by domain entity.
When I run module separatly, using host in module solution, endpoint works well and returns error when exception occurs
Endpoint
[Authorize(ProductManagementPermissions.Products.Create)]
public virtual async Task<ProductDto> CreateProduct(ProductCreateDto input)
{
Product product;
var attributeSet =
await _attributeSetRepository.InsertAsync(new AttributeSet(_guidGenerator.Create()), true);
var imageUri = !string.IsNullOrWhiteSpace(input.ImageUri) ? new Uri(input.ImageUri) : null;
product = new Product(
_guidGenerator.Create(),
_currentTenant.Id,
new ProductTitle(input.Title),
attributeSet,
new ProductCode(input.Code),
imageUri);
await _productRepository.InsertAsync(product);
return ObjectMapper.Map<Product, ProductDto>(product);
}
Product
public class Product : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public Guid? TenantId { get; }
public Guid? GroupId { get; }
public Guid AttributeSetId { get; }
public ProductTitle Title { get; private set; }
public ProductCode Code { get; private set; }
public Uri? ImageUri { get; private set; }
protected Product()
{
}
public Product(
Guid id,
Guid? tenantId,
ProductTitle title,
AttributeSet attributeSet,
ProductCode productCode,
Uri? imageUri = null)
: base(id)
{
TenantId = tenantId;
AttributeSetId = attributeSet.Id;
ImageUri = imageUri;
SetCode(productCode);
SetTitle(title);
}
internal Product(
Guid id,
Guid? tenantId,
Group group,
ProductTitle title,
AttributeSet attributeSet,
ProductCode productCode,
Uri? imageUri = null)
: this(id, tenantId, title, attributeSet, productCode, imageUri)
{
GroupId = group.Id;
}
public StockKeepingUnit CreateSku(Guid id, SkuCode code, SkuTitle title, AttributeSet attributeSet)
{
Check.NotNull(attributeSet.ParentAttributeSetId, nameof(attributeSet.ParentAttributeSetId));
var childHasDifferentParentSet = AttributeSetId != attributeSet.ParentAttributeSetId;
if (childHasDifferentParentSet)
{
throw new AttributeSetNotInheritedFromParentAttributeSetException(
parentSetId: AttributeSetId,
parentSetIdInChild: attributeSet.ParentAttributeSetId.Value);
}
return new StockKeepingUnit(
id,
TenantId,
this,
attributeSet,
title,
code,
ImageUri);
}
public void ChangeTitle(ProductTitle title)
{
SetTitle(title);
}
public void ChangeImageUri(Uri imageUri)
{
Check.NotNull(imageUri, nameof(imageUri));
}
private void SetTitle(ProductTitle title)
{
Check.NotNull(title, nameof(title));
Title = title;
AddLocalEvent(new ProductTitleAddingEvent()
{
Title = title
});
}
private void SetCode(ProductCode productCode)
{
Check.NotNull(productCode, nameof(productCode));
Code = productCode;
AddLocalEvent(new ProductCodeAddingEvent()
{
ProductCode = productCode
});
}
}
Event handler
public class ProductEventHandler :
ILocalEventHandler<ProductTitleAddingEvent>,
ILocalEventHandler<ProductCodeAddingEvent>,
ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
private readonly IProductRepository _productRepository;
public ProductEventHandler(
ICurrentTenant currentTenant,
IProductRepository productRepository)
{
_currentTenant = currentTenant;
_productRepository = productRepository;
}
public async Task HandleEventAsync(ProductTitleAddingEvent eventData)
{
if (await TitleAlreadyExist(eventData.Title))
{
throw new AlreadyExistException(eventData.Title.Value, nameof(Product));
}
}
public async Task HandleEventAsync(ProductCodeAddingEvent eventData)
{
if (await CodeAlreadyExist(eventData.ProductCode))
{
throw new AlreadyExistException(eventData.ProductCode.Value, nameof(Product));
}
}
private async Task<bool> TitleAlreadyExist(ProductTitle title)
{
return await _productRepository.CountAsync(p=>
p.TenantId == _currentTenant.Id && p.Title.Value == title.Value) > 1;
}
private async Task<bool> CodeAlreadyExist(ProductCode productCode)
{
return await _productRepository.CountAsync(p =>
p.TenantId == _currentTenant.Id && p.Code.Value == productCode.Value) > 1;
}
}