Exemple #1
0
        public RabbitMqPublisher(
            RabbitMqCorrelationManager correlationManager,
            ILoggerFactory loggerFactory,
            string connectionString,
            string exchangeName,
            bool enabled,
            ILog log,
            bool durable         = true,
            string messageFormat = null)
        {
            _enabled = enabled;
            if (!enabled)
            {
                log.WriteInfoAsync($"{GetType()}", "Constructor", $"A rabbit mq handler for {typeof(T)} is disabled");
                return;
            }
            var publisherSettings = new RabbitMqSubscriptionSettings
            {
                ConnectionString = connectionString,
                ExchangeName     = exchangeName,
                IsDurable        = durable
            };

            var serializer = GetSerializer(Enum.TryParse <RabbitMessageFormat>(messageFormat, out var format)
                ? format
                : default);
 public ExecutionReportPublisher(
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     string connectionString,
     string exchangeName,
     bool enabled,
     ILog log,
     bool durable = true)
     : base(correlationManager, loggerFactory, connectionString, exchangeName, enabled, log, durable)
 {
 }
Exemple #3
0
 public OrderBookSubscriber(
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     ILog log,
     string connectionString,
     string exchangeName,
     string queueName,
     bool isDurable,
     string messageFormat)
     : base(correlationManager, loggerFactory, log, connectionString, exchangeName, queueName, isDurable, messageFormat)
 {
 }
Exemple #4
0
 public FakeOrderBookFakePublisher(
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     string connectionString,
     string exchangeName,
     bool enabled,
     ILog log,
     bool durable         = false,
     string messageFormat = null)
     : base(correlationManager, loggerFactory, connectionString, exchangeName, enabled, log, durable, messageFormat)
 {
 }
Exemple #5
0
 public Application(
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     ILog logger,
     Settings settings,
     CurrentApplicationInfo applicationInfo,
     IAccountMarginEventsRepository accountMarginEventsRepository,
     ISlackNotificationsSender slackNotificationsSender)
     : base(correlationManager, loggerFactory, logger, slackNotificationsSender, applicationInfo)
 {
     _settings = settings;
     _accountMarginEventsRepository = accountMarginEventsRepository;
 }
Exemple #6
0
 protected BrokerApplicationBase(RabbitMqCorrelationManager correlationManager, ILoggerFactory loggerFactory, ILog logger, ISlackNotificationsSender slackNotificationsSender,
                                 CurrentApplicationInfo applicationInfo, MessageFormat messageFormat = MessageFormat.Json)
 {
     _correlationManager = correlationManager;
     LoggerFactory       = loggerFactory;
     Logger = logger;
     _slackNotificationsSender = slackNotificationsSender;
     ApplicationInfo           = applicationInfo;
     MessageDeserializer       = messageFormat == MessageFormat.Json
         ? new JsonMessageDeserializer <TMessage>()
         : (IMessageDeserializer <TMessage>) new MessagePackMessageDeserializer <TMessage>();
     MessageSerializer = messageFormat == MessageFormat.Json
         ? new JsonMessageSerializer <TMessage>()
         : (IRabbitMqSerializer <TMessage>) new MessagePackMessageSerializer <TMessage>();
 }
Exemple #7
0
 public Application(
     CorrelationContextAccessor correlationContextAccessor,
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     IOrdersHistoryRepository ordersHistoryRepository,
     ITradesRepository tradesRepository,
     ILog logger,
     Settings settings, CurrentApplicationInfo applicationInfo,
     ISlackNotificationsSender slackNotificationsSender) : base(correlationManager,
                                                                loggerFactory, logger, slackNotificationsSender, applicationInfo)
 {
     _correlationContextAccessor = correlationContextAccessor;
     _ordersHistoryRepository    = ordersHistoryRepository;
     _tradesRepository           = tradesRepository;
     _log      = logger;
     _settings = settings;
 }
 public Application(
     CorrelationContextAccessor correlationContextAccessor,
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     IAccountHistoryRepository accountHistoryRepository,
     ILog log,
     Settings settings,
     CurrentApplicationInfo applicationInfo,
     ISlackNotificationsSender slackNotificationsSender,
     IAccountsApi accountsApi)
     : base(correlationManager, loggerFactory, log, slackNotificationsSender, applicationInfo, MessageFormat.MessagePack)
 {
     _correlationContextAccessor = correlationContextAccessor;
     _accountHistoryRepository   = accountHistoryRepository;
     _log         = log;
     _settings    = settings;
     _accountsApi = accountsApi;
 }
 public Application(
     CorrelationContextAccessor correlationContextAccessor,
     RabbitMqCorrelationManager correlationManager,
     ILoggerFactory loggerFactory,
     IPositionsHistoryRepository positionsHistoryRepository,
     IDealsRepository dealsRepository,
     ILog logger,
     IConvertService convertService,
     Settings settings,
     CurrentApplicationInfo applicationInfo,
     ISlackNotificationsSender slackNotificationsSender)
     : base(correlationManager, loggerFactory, logger, slackNotificationsSender, applicationInfo)
 {
     _correlationContextAccessor = correlationContextAccessor;
     _positionsHistoryRepository = positionsHistoryRepository;
     _dealsRepository            = dealsRepository;
     _log            = logger;
     _settings       = settings;
     _convertService = convertService;
 }
        public RabbitMqSubscriber(
            RabbitMqCorrelationManager correlationManager,
            ILoggerFactory loggerFactory,
            ILog log,
            string connectionString,
            string exchangeName,
            string queueName,
            bool isDurable,
            string messageFormat)
        {
            _log = log;
            _connectionString   = connectionString;
            _exchangeName       = exchangeName;
            _queueName          = queueName;
            _isDurable          = isDurable;
            _correlationManager = correlationManager;
            _loggerFactory      = loggerFactory;

            _messageDeserializer = GetDeserializer(Enum.TryParse <RabbitMessageFormat>(messageFormat, out var format)
                ? format
                : default);
 public RabbitMqService(ILog logger, ILoggerFactory loggerFactory, RabbitMqCorrelationManager correlationManager)
 {
     _logger             = logger;
     _loggerFactory      = loggerFactory;
     _correlationManager = correlationManager;
 }