Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

51 lines (48 sloc) 1.87 KB
using Microsoft.Extensions.DependencyInjection;
using RawRabbit.DependencyInjection.ServiceCollection;
using RawRabbit.Instantiation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PolicyService.Messaging.RabbitMq
{
public static class RawRabbitInstaller
{
public static IServiceCollection AddRabbit(this IServiceCollection services)
{
services.AddRawRabbit(new RawRabbitOptions
{
ClientConfiguration = new RawRabbit.Configuration.RawRabbitConfiguration
{
Username = "guest",
Password = "guest",
VirtualHost = "/",
Port = 5672,
Hostnames = new List<string> {"localhost"},
RequestTimeout = TimeSpan.FromSeconds(10),
PublishConfirmTimeout = TimeSpan.FromSeconds(1),
RecoveryInterval = TimeSpan.FromSeconds(1),
PersistentDeliveryMode = true,
AutoCloseConnection = true,
AutomaticRecovery = true,
TopologyRecovery = true,
Exchange = new RawRabbit.Configuration.GeneralExchangeConfiguration
{
Durable = true,
AutoDelete = false,
Type = RawRabbit.Configuration.Exchange.ExchangeType.Topic
},
Queue = new RawRabbit.Configuration.GeneralQueueConfiguration
{
Durable = true,
AutoDelete = false,
Exclusive = false
}
}
});
services.AddSingleton<IEventPublisher,RabbitEventPublisher>();
return services;
}
}
}
You can’t perform that action at this time.