コード例 #1
0
 public RabbitMQMessagePublisher(IRabbitMQConnectionFactory connectionFactory,
                                 IOptions <RabbitMQPublisherConfig <T> > config, ICloudEventFormatter cloudEventFormatter)
 {
     _connectionFactory   = connectionFactory;
     _cloudEventFormatter = cloudEventFormatter;
     _config = config.Value;
 }
コード例 #2
0
 public RabbitMQQueueMonitor(
     ILogger <RabbitMQQueueMonitor <T> > logger,
     IOptions <RabbitMQConsumerOptions <T> > config,
     IRabbitMQConnectionFactory <T> connectionFactory
     )
 {
     _options           = config;
     _logger            = logger;
     _connectionFactory = connectionFactory;
 }
コード例 #3
0
        private IMessageConsumer <string> GetRabbitMQMessageConsumer(
            IRabbitMQConnectionFactory rabbitMqConnectionFactory = null,
            RabbitMQConsumerOptions <string> options             = null, IHostApplicationLifetime applicationLifetime = null)
        {
            rabbitMqConnectionFactory ??= GetDefaultConnectionFactoryMock().Object;
            applicationLifetime ??= FakeApplicationLifetime;
            var optionsWrapper = new OptionsWrapper <RabbitMQConsumerOptions <string> >(options ?? GetConfig());

            return(new RabbitMQMessageConsumer <string>(FakeLogger, rabbitMqConnectionFactory, optionsWrapper,
                                                        applicationLifetime, GetApplicationNameService(), new JsonEventFormatter()));
        }
コード例 #4
0
    private IMessageConsumer <string> GetRabbitMQMessageConsumer(
        IRabbitMQConnectionFactory <string>?rabbitMqConnectionFactory = null,
        RabbitMQConsumerOptions <string>?options     = null,
        IHostApplicationLifetime?applicationLifetime = null)
    {
        rabbitMqConnectionFactory ??= GetDefaultConnectionFactoryMock <string>().Object;
        applicationLifetime ??= FakeApplicationLifetime;
        var optionsWrapper = Options.Create(options ?? GetConfig());

        return(new RabbitMQMessageConsumer <string>(FakeLogger, rabbitMqConnectionFactory, optionsWrapper,
                                                    applicationLifetime, GetApplicationNameService()));
    }
コード例 #5
0
        private ITypedMessagePublisher <byte[]> GetPublisher(
            IRabbitMQConnectionFactory connectionFactory = null,
            RabbitMQPublisherConfig <string> config      = null)
        {
            connectionFactory ??= GetDefaultConnectionFactoryMock().Object;
            config ??= GetConfig();

            var configMock = new Mock <IOptions <RabbitMQPublisherConfig <string> > >();

            configMock.Setup(x => x.Value).Returns(config);
            return(new RabbitMQMessagePublisher <string>(connectionFactory, configMock.Object, new JsonEventFormatter()));
        }
コード例 #6
0
 public RabbitMQMessageConsumer(ILogger <RabbitMQMessageConsumer <T> > logger,
                                IRabbitMQConnectionFactory connectionFactory, IOptions <RabbitMQConsumerConfig <T> > config,
                                IHostApplicationLifetime applicationLifetime, IApplicationNameService applicationNameService,
                                ICloudEventFormatter cloudEventFormatter)
 {
     _logger                 = logger;
     _connectionFactory      = connectionFactory;
     _config                 = config.Value;
     _applicationLifetime    = applicationLifetime;
     _applicationNameService = applicationNameService;
     _cloudEventFormatter    = cloudEventFormatter;
 }
コード例 #7
0
 public RabbitMQMessageConsumer(ILogger <RabbitMQMessageConsumer <T> > logger,
                                IRabbitMQConnectionFactory <T> connectionFactory,
                                IOptions <RabbitMQConsumerOptions <T> > config,
                                IHostApplicationLifetime applicationLifetime,
                                IApplicationNameService applicationNameService)
 {
     _logger                 = logger;
     ConnectionFactory       = connectionFactory;
     _options                = config.Value;
     _applicationLifetime    = applicationLifetime;
     _applicationNameService = applicationNameService;
 }
コード例 #8
0
 public RabbitMQMessagePublisher(
     IRabbitMQConnectionFactory <TOutput> connectionFactory,
     IOptions <RabbitMQPublisherOptions <TOutput> > config,
     IOptions <PublisherOptions> publisherOptions,
     CloudEventFormatter cloudEventFormatter
     )
 {
     ConnectionFactory    = connectionFactory;
     _options             = config.Value;
     _publisherOptions    = publisherOptions.Value;
     _cloudEventFormatter = cloudEventFormatter;
 }
コード例 #9
0
    private IRawMessagePublisher <string> GetPublisher(
        IRabbitMQConnectionFactory <string>?factory = null,
        RabbitMQPublisherOptions <string>?options   = null,
        bool overwriteExchange            = false,
        CloudEventFormat cloudEventFormat = CloudEventFormat.Protocol)
    {
        options ??= GetConfig(overwriteExchange);
        factory ??= GetDefaultConnectionFactoryMock <string>().Object;

        var optionsMock = Options.Create(options);

        return(new RabbitMQMessagePublisher <string>(
                   factory,
                   optionsMock,
                   Options.Create(new PublisherOptions {
            CloudEventFormat = cloudEventFormat
        }),
                   new JsonEventFormatter()
                   ));
    }
コード例 #10
0
 public RabbitMQSubscriber(IRabbitMQConnectionFactory connectionFactory)
 {
     connection = connectionFactory.CreateConnection();
 }
コード例 #11
0
ファイル: TaskPublisher.cs プロジェクト: niraymak/dex-backend
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskPublisher"/> class.
 /// </summary>
 public TaskPublisher(IRabbitMQConnectionFactory connectionFactory)
 {
     connection = connectionFactory.CreateConnection();
 }
コード例 #12
0
 public RabbitMQReceiver(IRabbitMQConnectionFactory connectionFactory)
 {
     _connectionFactory = connectionFactory;
 }