Revert "Add Queue to Dependency Injection (Optimize)"
This reverts commit cf7a79166a.
This commit is contained in:
parent
cf7a79166a
commit
a27f3551d8
3 changed files with 35 additions and 118 deletions
|
|
@ -21,8 +21,6 @@ using System.Transactions;
|
|||
using BMA.EHR.Leave.Service.Filters;
|
||||
using Hangfire.Common;
|
||||
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
|
||||
using RabbitMQ.Client;
|
||||
using BMA.EHR.Leave.Service.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
|
|
@ -30,51 +28,6 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
var key = builder.Configuration["Jwt:Key"];
|
||||
|
||||
|
||||
// ตั้งค่า RabbitMQ connection
|
||||
builder.Services.AddSingleton<IConnection>(sp =>
|
||||
{
|
||||
var factory = new ConnectionFactory()
|
||||
{
|
||||
HostName = builder.Configuration["Rabbit:Host"],
|
||||
UserName = builder.Configuration["Rabbit:User"],
|
||||
Password = builder.Configuration["Rabbit:Password"],
|
||||
};
|
||||
return factory.CreateConnection();
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddSingleton<IModel>(sp =>
|
||||
{
|
||||
var connection = sp.GetRequiredService<IConnection>();
|
||||
var channel = connection.CreateModel();
|
||||
|
||||
// ประกาศ queue
|
||||
channel.QueueDeclare(queue: "fake-checkin-queue",
|
||||
durable: true,
|
||||
exclusive: false,
|
||||
autoDelete: false,
|
||||
arguments: null);
|
||||
|
||||
return channel;
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddSingleton<IModel>(sp =>
|
||||
{
|
||||
var connection = sp.GetRequiredService<IConnection>();
|
||||
var channel = connection.CreateModel();
|
||||
|
||||
// ประกาศ queue
|
||||
channel.QueueDeclare(queue: "checkin-queue",
|
||||
durable: true,
|
||||
exclusive: false,
|
||||
autoDelete: false,
|
||||
arguments: null);
|
||||
|
||||
return channel;
|
||||
});
|
||||
|
||||
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
|
@ -136,8 +89,6 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
builder.Services.AddPersistence(builder.Configuration);
|
||||
builder.Services.AddLeavePersistence(builder.Configuration);
|
||||
|
||||
builder.Services.AddSingleton<RabbitCheckInService>();
|
||||
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.SuppressAsyncSuffixInActionNames = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue