public EventBusRabbitMqConsumer(IRabbitMqConnection connection, IMediator mediator, IMapper mapper, IOrderRepository repository) { _connection = connection; _mediator = mediator; _mapper = mapper; _repository = repository; }
public EventDispatcher(IRabbitMqConnection connection) { _connection = connection; Setup(); _handlers = new Dictionary <string, MethodInfo>(); FindHandlers(); }
public RabbitMqBus(string endpointId, string endpointName) { _rabbitMqConnection = new RabbitMqConnection(); _endpointId = endpointId; _endpointName = endpointName; // Subscribe(); }
public EventBusRabbitMqConsumer(IOrderRepository orderRepository, IMapper mapper, IMediator mediator, IRabbitMqConnection rabbitMqConnection) { _orderRepository = orderRepository; _mapper = mapper; _mediator = mediator; _rabbitMqConnection = rabbitMqConnection; }
public EventBusRabbitMqConsumer(IRabbitMqConnection connection, IMediator mediator, IMapper mapper, IOrderPepository repository) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _repository = repository ?? throw new ArgumentNullException(nameof(repository)); }
public DeadLetterQueueFactory( IRabbitMqConnection connectionManager, IOptions <NetRabbitConfiguration> options) { this.connectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager)); this.options = options.Value ?? throw new ArgumentNullException(nameof(options)); }
public RpcCallConsumer(string exchangeName, IServiceProvider serviceProvider, IRabbitMqConnection connection) { _queueName = typeof(TRequest).Name; _exchangeName = exchangeName; _serviceProvider = serviceProvider; _connection = connection; }
public RabbitMqConsumer(string queueName, IServiceProvider serviceProvider, IRabbitMqConnection connection) { _queueName = queueName; _messageHandler = new MessageHandler(serviceProvider); _connection = connection; _supportedMessages = new Dictionary <string, Type>(); }
public AuditLogger(IEventRepository eventRepo, IRabbitMqConnection connection, ILogService logger) { _eventRepo = eventRepo; _connection = connection; _logger = logger; Setup(); }
public RabbitMqConsumer(string exchange, string queueName, IServiceProvider serviceProvider, IRabbitMqConnection connection) { _exchange = exchange; _queueName = queueName; _connection = connection; _supportedMessages = new Dictionary <string, Type>(); _serviceProvider = serviceProvider; }
public RabbitMqPublisher(ILogWriter logWriter, IRabbitMqConnection connection, RabbitMQConfiguration rabbitConfig) { _logWriter = logWriter; _connection = connection; _rabbitConfig = rabbitConfig; }
/// <summary> /// Create a new router from config settings /// </summary> public RabbitRouter(IChannelAction longTermConnection, IRabbitMqConnection shortTermConnection) { _lockObject = new object(); _longTermConnection = longTermConnection; _shortTermConnection = shortTermConnection; queues = new HashSet<string>(); exchanges = new HashSet<string>(); noOptions = new Dictionary<string, object>(); }
public RabbitMqPublisherService( IRabbitMqConnection rabbitMqConnection, IConfiguration configuration, ILogger <RabbitMqPublisherService> logger) { _rabbitMqConnection = rabbitMqConnection; _logger = logger; _rabbitMqConfig = configuration.GetSection("RabbitMq"); }
/// <summary> RabbitMQ事件总线 </summary> /// <param name="connection"></param> /// <param name="subsManager"></param> /// <param name="messageCodec"></param> public EventBusRabbitMq(IRabbitMqConnection connection, ISubscribeManager subsManager, IMessageCodec messageCodec) : base(subsManager, messageCodec, connection?.Name) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _brokerName = connection.Broker; _logger = CurrentIocManager.CreateLogger <EventBusRabbitMq>(); SubscriptionManager.OnEventRemoved += SubsManager_OnEventRemoved; }
public LoginLogMqConsumer( IRabbitMqConnection mqConnection , ILogger <LoginLogMqConsumer> logger , IServiceProvider services) : base(mqConnection, logger) { _services = services; _logger = logger; }
public RabbitMessageQueue(IRabbitMqConnection connection, string queue) { _connection = connection; _encoding = Encoding.UTF8; _logger = CurrentIocManager.CreateLogger <RabbitMessageQueue>(); _queue = queue; Channel.ExchangeDeclare(_connection.Broker, ExchangeType.Direct, false, true); Channel.QueueDeclare(_queue, true, false, false); Channel.QueueBind(_queue, _connection.Broker, _queue); }
public EventBus(IRabbitMqConnection connection, ILifetimeScope autofac, ISubscriptionsManage subsManager, ILogger logger, string queueName = null) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _subscriptionsManage = subsManager ?? new SubscriptionsManager(); _queueName = queueName; _consumerChannel = CreateConsumerChannel(); _autofac = autofac; _logger = logger; }
/// <summary> /// Create a new router from config settings /// </summary> public RabbitRouter(IChannelAction longTermConnection, IRabbitMqConnection shortTermConnection) { _lockObject = new object(); _longTermConnection = longTermConnection ?? throw new ArgumentNullException(nameof(longTermConnection)); _shortTermConnection = shortTermConnection ?? throw new ArgumentNullException(nameof(shortTermConnection)); queues = new HashSet <string>(); exchanges = new HashSet <string>(); noOptions = new Dictionary <string, object>(); }
public BasketCheckoutConsumer( IRabbitMqConnection connnection , IMediator mediator , IMapper mapper , IOrderRepository repository) { _connnection = connnection; _mediator = mediator; _mapper = mapper; _repository = repository; }
public RabbitMqTenderingService(IServiceProvider service, IRabbitMqConnection connection) { if (connection.Connection != null) { _channel = connection.Connection.CreateModel(); _consumer = new EventingBasicConsumer(_channel); _consumer.Received += OnConsumerReceived; } _exchangeName = connection.Configuration.TenderExchangeName; _service = service; InitializeRabbitMqListener(); }
public NetRabbitEventBus( IRabbitMqConnection connectionManager, IPublishConfirmer publishConfirmer, ConfigurationOptions configurationOptions, IOptions <NetRabbitConfiguration> options, ILogger <NetRabbitEventBus> logger) { this.connectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager)); this.publishConfirmer = publishConfirmer ?? throw new ArgumentNullException(nameof(publishConfirmer)); this.serializer = configurationOptions.Serializer ?? throw new ArgumentNullException(nameof(configurationOptions.Serializer)); this.options = options.Value ?? throw new ArgumentNullException(nameof(options)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public RabbitMqActionBenefitService(IServiceProvider service, IRabbitMqConnection connection, IOptions <MailSettings> mailSettings) { if (connection.Connection != null) { _channel = connection.Connection.CreateModel(); _consumer = new EventingBasicConsumer(_channel); _consumer.Received += OnConsumerReceived; } _queueName = connection.Configuration.ActionBenefitQueueName; _service = service; _mailSettings = mailSettings.Value; InitializeRabbitMqListener(); }
public NetRabbitSubscription( IRabbitMqConnection connectionManager, IDeadLetterQueueFactory deadLetterQueue, IEventsListener eventsListener, IOptions <NetRabbitConfiguration> options, ILogger <NetRabbitSubscription> logger) { this.connectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager)); this.deadLetterQueue = deadLetterQueue ?? throw new ArgumentNullException(nameof(deadLetterQueue)); this.eventsListener = eventsListener ?? throw new ArgumentNullException(nameof(eventsListener)); this.options = options.Value ?? throw new ArgumentNullException(nameof(options)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public RabbitMqSubscriberService( IRabbitMqConnection rabbitMqConnection, IConfiguration configuration, IServiceScopeFactory serviceScopeFactory, ILogger <RabbitMqSubscriberService> logger) { _rabbitMqConnection = rabbitMqConnection; _serviceScopeFactory = serviceScopeFactory; _logger = logger; var rabbitMqSettings = configuration.GetSection("RabbitMq"); _queueName = rabbitMqSettings["Queue"]; }
public EventsListener( IRabbitMqConnection connectionManager, INotifier notifier, ConfigurationOptions configurationOptions, ILogger <EventsListener> logger) { this.connectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager)); this.serializer = configurationOptions.Serializer ?? throw new ArgumentNullException(nameof(configurationOptions.Serializer)); this.notifier = notifier ?? throw new ArgumentNullException(nameof(notifier)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.eventTypes = configurationOptions.NotificationsAssembly.GetTypes().Where(t => typeof(INotification).IsAssignableFrom(t)).ToList(); }
/// <summary> /// Выполняет инициализацию очереди /// </summary> /// <param name="connection">Соединение, которому принадлежит очередь</param> /// <param name="initialConfig">Конфигурация очереди</param> public override void Init(IRabbitMqConnection connection, QueueConfig initialConfig) { base.Init(connection, initialConfig); this.DeclareQueue(); this.consumer = new AsyncEventingBasicConsumer(this.Connection.Channel); this.consumer.Received += this.RabbitEventHandlerAsync; lock (this.Connection) { this.Connection.Channel.BasicConsume(this.InitialConfig.Name, false, this.consumer); } }
public RabbitMqSubscriberService( IRabbitMqConnection rabbitMqConnection, IConfiguration configuration, IMediator mediator, ILogger <RabbitMqSubscriberService> logger) { _rabbitMqConnection = rabbitMqConnection; _mediator = mediator; _logger = logger; var rabbitMqSettings = configuration.GetSection("RabbitMq"); _queueName = rabbitMqSettings["Queue"]; _exchangeName = rabbitMqSettings["Exchange"]; }
public EventBusRabbitMq( IRabbitMqConnection rabbitMqConnection, ILogger <EventBusRabbitMq> logger, ILifetimeScope lifetimeScope, IHttpClientFactory httpClientFactory, string queueName = null, int retryCount = 5) { _rabbitMqConnection = rabbitMqConnection; _logger = logger; _lifetimeScope = lifetimeScope; _queueName = queueName; _retryCount = retryCount; _model = CreateConsumerChannel(); _httpClientFactory = httpClientFactory; }
public RabbitMqErrorHandlerConnection(IRabbitMqConnection connection, ILogger <RabbitMqPublisherConnection> logger) { _logger = logger; _connection = new Lazy <IConnection>(() => { _logger.LogWarning("Creating error handler RabbitMQ connection"); var physicalConnection = connection.Create(ConnectionType.Error); physicalConnection.CallbackException += OnPhysicalConnectionCallbackException; physicalConnection.ConnectionBlocked += OnPhysicalConnectionBlocked; physicalConnection.ConnectionShutdown += OnPhysicalConnectionShutdown; physicalConnection.ConnectionUnblocked += OnPhysicalConnectionUnblocked; return(physicalConnection); }); }
public RabbitMqQueueMessage( Guid messageId, IRabbitMqConnection rabbitMqConnection, Type type, IRabbitMqEvent content, bool redelivered, ulong deliveryTag, bool isAutoAck) { _rabbitMqConnection = rabbitMqConnection; _deliveryTag = deliveryTag; _isAutoAck = isAutoAck; MessageId = messageId; Type = type; Content = content; DequeueCount = redelivered ? 1 : 0; }
public void a_set_of_configured_components_being_shut_down() { MessagingSystem.Control.Shutdown(); _receiverControl = Substitute.For<IReceiverControl>(); _channelAction = Substitute.For<IChannelAction>(); _sender = Substitute.For<ISenderNode>(); _rabbitConn = Substitute.For<IRabbitMqConnection>(); ObjectFactory.Configure(map => { map.For<IReceiverControl>().Use(_receiverControl); map.For<IChannelAction>().Use(_channelAction); map.For<ISenderNode>().Use(_sender); map.For<IRabbitMqConnection>().Use(_rabbitConn); }); MessagingSystem.Control.Shutdown(); }
public RabbitMqBusSubscriber(IRabbitMqConnection connection, IEventProcessor eventProcessor, IOptions <RabbitMqOption> optionWrap) { var option = optionWrap.Value; _queueName = option.Client; _exchanges = option.Exchanges ?? new string[0]; _connection = connection; _eventProcessor = eventProcessor; _eventProcessor.Setup(eventName => { using var channel = _connection.CreateModel(); foreach (var exchange in _exchanges) { channel.QueueBind(queue: _queueName, exchange: exchange, routingKey: eventName); } }); }
/// <summary> /// Configure long and short term connections to use the specified connection details /// </summary> public MessagingBaseConfiguration WithConnection(IRabbitMqConnection connection) { configuredConnection = connection; ObjectFactory.Configure(map => map.For<IRabbitMqConnection>().Use(() => configuredConnection)); return this; }
static ConfigurationHelpers() { conn = FreshConnectionFromAppConfig(); }