public AmqpConsumer(IModel channel, IPublisher publisher, IBuilder builder, IQueueApiManager manager)
 {
     this.channel   = channel ?? throw new System.ArgumentNullException(nameof(channel));
     this.publisher = publisher ?? throw new System.ArgumentNullException(nameof(publisher));
     this.builder   = builder ?? throw new System.ArgumentNullException(nameof(builder));
     this.manager   = manager ?? throw new System.ArgumentNullException(nameof(manager));
 }
Exemple #2
0
 public RabbitMqPublisher(IModel channel, ISerializer serializer, IQueueApiManager manager, IMessagePublisher messagePublisher)
 {
     _channel          = channel;
     _serializer       = serializer;
     _manager          = manager;
     _messagePublisher = messagePublisher;
 }
Exemple #3
0
 public RabbitMqConsumer(IModel channel, IPublisher publisher, IBuilder builder, IQueueApiManager manager, IMessageProcessor messageProcessor)
 {
     _channel          = channel ?? throw new ArgumentNullException(nameof(channel));
     _publisher        = publisher ?? throw new ArgumentNullException(nameof(publisher));
     _builder          = builder ?? throw new ArgumentNullException(nameof(builder));
     _manager          = manager ?? throw new ArgumentNullException(nameof(manager));
     _messageProcessor = messageProcessor;
     ConsumerTag       = string.Empty;
 }
Exemple #4
0
        public IQueueApiManager BuildApiManager()
        {
            if (_apiManager != null)
            {
                return(_apiManager);
            }

            _logger.LogTrace(Resources.APIManagerCreating);
            var url = _config.GetValue <string>(EnvironmentConstants.MessageBrokerApiUrl);

            var(user, password) = GetUserData(url);
            var channel = Connection.CreateModel();

            _apiManager = new RabbitMqApiManager(url, user, password, channel);

            return(_apiManager);
        }
        public IQueueApiManager BuildAPIManager()
        {
            if (apiManager != null)
            {
                return(apiManager);
            }

            logger.LogTrace("Creating a new API Manager instance.");
            var parser   = new Uri(this.appSettings.GetValue <string>("RABBIT_API_URL"));
            var userInfo = parser.UserInfo.Split(new[] { ':' });
            var user     = userInfo.Length >= 1 && !string.IsNullOrEmpty(userInfo[0]) ? userInfo[0] : "guest";
            var password = userInfo.Length >= 2 ? userInfo[1] : "guest";

            apiManager = new RabbitMQApiManager(this.appSettings.GetValue <string>("RABBIT_API_URL"),
                                                user,
                                                password,
                                                connection.CreateModel());

            return(apiManager);
        }
Exemple #6
0
        private void TestAmqpConsumerConstructor(IModel model, IPublisher publisher, IBuilder builder, IQueueApiManager manager, string parameter)
        {
            Action action = () => new RabbitMqConsumer(model, publisher, builder, manager, _messageProcessorMock.Object);

            action.Should()
            .Throw <ArgumentNullException>()
            .WithMessage(string.Format(Properties.Resources.ValueCanNotBeNull, parameter));
        }
Exemple #7
0
 public ProtectedConsumer(IModel channel, IPublisher publisher, IBuilder builder, IQueueApiManager manager, IMessageProcessor messageProcessor) :
     base(channel, publisher, builder, manager, messageProcessor)
 {
 }
 public AmqpPublisher(IModel channel, ISerializer serializer, IQueueApiManager manager)
 {
     this.channel    = channel;
     this.serializer = serializer;
     this.manager    = manager;
 }