public BusinessConsumer(IEventBusConnection connection, IMapper mapper, IAudioServerRepository audioRepository, IVideoServerRepository videoRepository, IPhotoServerRepository photoRepository, IOptions <EventBusConstants> constants) { _connection = connection; _mapper = mapper; _audioRepository = audioRepository; _videoRepository = videoRepository; _photoRepository = photoRepository; _constants = constants.Value; }
private void AddEventBusServices(IServiceCollection services) { services.AddSingleton <IEventBusConnection>(sp => { string hostName = Environment.GetEnvironmentVariable("RabbitHostName"); string userName = Environment.GetEnvironmentVariable("RabbitUserName"); string password = Environment.GetEnvironmentVariable("RabbitPassword"); string virtualHost = Environment.GetEnvironmentVariable("RabbitVirtualHost"); int port = int.Parse(Environment.GetEnvironmentVariable("RabbitPort")); return(new ConnectionRabbitMQ(hostName, port, userName, password, virtualHost)); }); services.AddSingleton <IEventBusSubscriptionsManager, EventBusSubscriptionsManager>(); services.AddSingleton <IEventBus, EventBusRabbitMQ>(sp => { IEventBusConnection rabbitMQConnection = sp.GetRequiredService <IEventBusConnection>(); IEventBusSubscriptionsManager eventBusSubscriptionManager = sp.GetRequiredService <IEventBusSubscriptionsManager>(); ILifetimeScope lifetimeScope = sp.GetRequiredService <ILifetimeScope>(); string exchangeName = Environment.GetEnvironmentVariable("RabbitExchangeName"); ExchangeType exchangeType = (ExchangeType)int.Parse(Environment.GetEnvironmentVariable("RabbitExchangeType")); bool exchangeIsDurable = bool.Parse(Environment.GetEnvironmentVariable("RabbitExchangeIsDurable")); bool exchangeIsAutoDelete = bool.Parse(Environment.GetEnvironmentVariable("RabbitExchangeIsAutoDelete")); EventBusExchange exchange = new EventBusExchange(exchangeName, exchangeType, exchangeIsDurable, exchangeIsAutoDelete, null); string queueName = Environment.GetEnvironmentVariable("RabbitQueueName"); bool queueIsDurable = bool.Parse(Environment.GetEnvironmentVariable("RabbitQueueIsDurable")); bool queueIsExclusive = bool.Parse(Environment.GetEnvironmentVariable("RabbitQueueIsExclusive")); bool queueIsAutoDelete = bool.Parse(Environment.GetEnvironmentVariable("RabbitQueueIsAutoDelete")); EventBusQueue queue = new EventBusQueue(queueName, queueIsDurable, queueIsExclusive, queueIsAutoDelete, null); return(new EventBusRabbitMQ(rabbitMQConnection, eventBusSubscriptionManager, lifetimeScope, exchange, queue)); }); services.AddTransient <SendLogMessageEventHandler>(); }
/// <summary> /// Initializes instance of ServiceBus from the connection string /// </summary> /// <param name="serviceBusPersisterConnection">AzureServiceBus connection string</param> #region Constructor public EventBus(IEventBusConnection serviceBus) { this.serviceBus = serviceBus; }
public RabbitMqEventBus(IEventBusConnection connection) { _channel = connection.Connection.CreateModel(); }
public EventConsumer(IEventBusConnection connection) { _connection = connection; }
public EventProducer(IEventBusConnection connection) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); }
public BusinessProducer(IEventBusConnection connection) { _connection = connection; }