Beispiel #1
0
        public RabbitPublisher(IOptions <RabbitSettings> options, ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger <RabbitPublisher>();

            _settings = options.Value;

            var factory = new ConnectionFactory
            {
                HostName    = _settings.Host,
                Password    = _settings.Password,
                UserName    = _settings.UserName,
                Port        = _settings.Port,
                VirtualHost = _settings.VirtualHost
            };

            _connection = factory.CreateConnection();

            _channel = _connection.CreateModel();
            foreach (var ep in _settings.RabbitEndpoints.Values)
            {
                _channel.ExchangeDeclare(ep.Exchange, ep.ExchangeType);
            }

            //_channel.QueueDeclare(_settings.Queue, false, false, false, null);
        }
Beispiel #2
0
        public RabbitConsumer(ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IOptions <RabbitSettings> options)
        {
            _serviceProvider = serviceProvider;
            _settings        = options.Value;

            _logger = loggerFactory.CreateLogger <RabbitConsumer>();

            var factory = new ConnectionFactory
            {
                HostName    = _settings.Host,
                Password    = _settings.Password,
                UserName    = _settings.UserName,
                Port        = _settings.Port,
                VirtualHost = _settings.VirtualHost
            };

            // create connection
            _connection = factory.CreateConnection();

            // create channel
            _channel = _connection.CreateModel();

            foreach (var ep in _settings.RabbitEndpoints.Values)
            {
                _channel.ExchangeDeclare(ep.Exchange, ep.ExchangeType);
                _channel.QueueDeclare(ep.Queue, false, false, false, null);
                _channel.QueueBind(ep.Queue, ep.Exchange, ep.RoutingKey);
                _channel.BasicQos(0, 1, false);
            }

            _connection.ConnectionShutdown += RabbitMQ_ConnectionShutdown;
        }
        private void RegisterRabbit(ContainerBuilder builder)
        {
            RabbitSettings rabbitSettings = _appSettings.CurrentValue.MarketMakerReportsService.Rabbit;

            builder.RegisterType <AuditMessageSubscriber>()
            .As <IStartable>()
            .As <IStoppable>()
            .WithParameter(TypedParameter.From(rabbitSettings.AuditMessage))
            .SingleInstance();

            builder.RegisterType <InventorySnapshotSubscriber>()
            .As <IStartable>()
            .As <IStoppable>()
            .WithParameter(TypedParameter.From(rabbitSettings.InventorySnapshot))
            .SingleInstance();

            builder.RegisterType <LykkeTradeSubscriber>()
            .As <IStartable>()
            .As <IStoppable>()
            .WithParameter(TypedParameter.From(rabbitSettings.LykkeTrade))
            .SingleInstance();

            builder.RegisterType <ExternalTradeSubscriber>()
            .As <IStartable>()
            .As <IStoppable>()
            .WithParameter(TypedParameter.From(rabbitSettings.ExternalTrade))
            .SingleInstance();

            builder.RegisterType <HealthIssueSubscriber>()
            .As <IStartable>()
            .As <IStoppable>()
            .WithParameter(TypedParameter.From(rabbitSettings.HealthIssue))
            .SingleInstance();
        }
 public InvoiceConfirmationSubscriber(RabbitSettings settings,
                                      IInvoiceConfirmationService service, ILogFactory logFactory)
 {
     _settings   = settings;
     _logFactory = logFactory;
     _log        = logFactory.CreateLog(this);
     _service    = service;
 }
Beispiel #5
0
 public RabbitQueueService(ILogger <RabbitQueueService> logger,
                           IOptions <RabbitSettings> options,
                           ITracer tracer)
 {
     _logger   = logger;
     _tracer   = tracer;
     _settings = options.Value;
 }
Beispiel #6
0
 public InvoiceUpdatePublisher(
     RabbitSettings rabbitSettings,
     ILogFactory logFactory)
 {
     _rabbitSettings = rabbitSettings;
     _logFactory     = logFactory;
     _log            = logFactory.CreateLog(this);
 }
Beispiel #7
0
 public RabbitMqBus(IMediator mediator, RabbitSettings rabbitSettings, IServiceScopeFactory serviceScopeFactory)
 {
     _mediator            = mediator;
     _serviceScopeFactory = serviceScopeFactory;
     _handlers            = new Dictionary <string, List <Type> >();
     _eventTypes          = new List <Type>();
     _rabbitSettings      = rabbitSettings;
 }
Beispiel #8
0
        public RabbitMqModule(IReloadingManager <AppSettings> reloadingManager)
        {
            var appSettings = reloadingManager.CurrentValue;

            _rabbitSettings = appSettings.PrivateBlockchainFacadeService.Rabbit;

            _isPublicBlockChainFeatureDisabled = appSettings.PrivateBlockchainFacadeService.IsPublicBlockchainFeatureDisabled
                                                 ?? false;
        }
 public PaymentRequestSubscriber(
     ICallbackService callbackService,
     RabbitSettings settings,
     ILogFactory logFactory)
 {
     _callbackService = callbackService;
     _logFactory      = logFactory;
     _log             = logFactory.CreateLog(this);
     _settings        = settings;
 }
 public InvoicePaymentRequestSubscriber(
     IInvoiceService invoiceService,
     RabbitSettings settings,
     ILogFactory logFactory)
 {
     _invoiceService = invoiceService;
     _log            = logFactory.CreateLog(this);
     _settings       = settings;
     _logFactory     = logFactory;
 }
 public InvoiceUpdateSubscriber(
     IRealtimeNotificationsService realtimeNotificationsService,
     RabbitSettings rabbitSettings,
     ILogFactory logFactory)
 {
     _realtimeNotificationsService = realtimeNotificationsService;
     _rabbitSettings = rabbitSettings;
     _logFactory     = logFactory;
     _log            = logFactory.CreateLog(this);
 }
Beispiel #12
0
 public NotificationsPaymentRequestSubscriber(
     RabbitSettings settings,
     ILogFactory logFactory,
     IInvoiceNotificationsService notificationsService)
 {
     _settings             = settings;
     _logFactory           = logFactory;
     _notificationsService = notificationsService;
     _log = logFactory.CreateLog(this);
 }
Beispiel #13
0
        private async void button1_Click(object sender, EventArgs e)
        {
            var            ip     = textBox1.Text;
            var            queue  = textBox2.Text;
            RabbitSettings rabbit = new RabbitSettings()
            {
                IpServer = ip, QueueName = queue
            };

            Settings.Rabbit = rabbit;
            await Settings.SaveSettings();

            this.Close();
        }
 public RabbitModule(IReloadingManager <AppSettings> settings)
 {
     _settings = settings.CurrentValue.VouchersService.Rabbit;
 }
Beispiel #15
0
 public MessagePublisher(IOptions <RabbitSettings> rabbitSettings, IConnection connection)
 {
     _rabbitSettings = rabbitSettings.Value;
     _connection     = connection;
 }
Beispiel #16
0
 public RabbitSubscriber(IOptions <RabbitSettings> rabbitSettings)
 {
     _rabbitSettings = rabbitSettings.Value;
 }
 public CustomWebHostService(IWebHost host, ISubscriber subscriber, IOptions <RabbitSettings> options) : base(host)
 {
     _logger     = host.Services.GetRequiredService <ILogger <CustomWebHostService> >();
     _subscriber = subscriber ?? throw new ArgumentNullException(nameof(subscriber));
     _options    = options.Value ?? throw new ArgumentNullException(nameof(options));
 }
 public RabbitChannelPooledObjectPolicy(IOptions <RabbitSettings> rabbitSettings)
 {
     this._rabbitSettings = rabbitSettings.Value;
     this._connection     = this.GetConnection();
 }
Beispiel #19
0
 public ProjectGroupCreatedEventListener(IPooledObjectPolicy <IModel> objectPolicy, IOptions <RabbitSettings> rabbitSettings, IServiceScopeFactory scopeFactory)
     : base(objectPolicy)
 {
     this._rabbitSettings = rabbitSettings.Value;
     this._scopeFactory   = scopeFactory;
 }
Beispiel #20
0
 public Subscriber(IOptions <RabbitSettings> options, IMessageProcessorFactory factory, Serializer <string> serializer)
 {
     _options    = options.Value;
     _factory    = factory ?? throw new ArgumentNullException(nameof(factory));
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
 }