feat: Change RAbbitMQ Conenction to Pool and Add k6 Test Script for max request per second.
This commit is contained in:
parent
0bac3630ec
commit
f5355728ab
7 changed files with 186 additions and 44 deletions
|
|
@ -0,0 +1,20 @@
|
|||
using BMA.EHR.Leave.Service.Services;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using RabbitMQ.Client;
|
||||
|
||||
namespace BMA.EHR.Leave.Service.Extensions
|
||||
{
|
||||
public static class RabbitMqServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddRabbitMqConnectionPooling(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();
|
||||
services.AddSingleton<ObjectPool<IModel>>(sp =>
|
||||
{
|
||||
var provider = sp.GetRequiredService<ObjectPoolProvider>();
|
||||
return provider.Create(new RabbitMqConnectionPoolPolicy(configuration));
|
||||
});
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue