public void SetUp()
		{
			var _busConfigurationBuilder = new BusConfigurationBuilder();
			_busConfigurationBuilder.ConnectionUris.Add("....");
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				typeof(MyEvent).Name,
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
						return ConsumerHandlerResult.Completed;
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				typeof(MyEvent).FullName,
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
						return ConsumerHandlerResult.Completed;
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				"Throw_Error_Type_Header",
				message =>
					{
						throw new ApplicationException("Bang !");
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				"Returns_Errored_Result",
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Errored;
						return ConsumerHandlerResult.Errored;
					});
			var _busConfiguration = _busConfigurationBuilder.Build();

			var _connection = Substitute.For<IConnection>();

			this.c_channel = Substitute.For<IModel>();
			_connection.CreateModel().Returns(this.c_channel);

			this.c_SUT = new ConsumerMessageProcessor(_busConfiguration);

			this.c_messageProcessrResult = ConsumerHandlerResult.None;
		}
Пример #2
0
        public Consumer(
            IConnection connection,
            BusConfiguration configuration)
        {
            this.c_logger = LogManager.GetLogger(this.GetType());
            this.c_logger.Info("ctor Starting");

            this.c_configuration = configuration;

            this.c_logger.Info("ctor About to create channel");
            this.c_channel = connection.CreateModel();
            this.c_channel.ModelShutdown += (m, args) => this.OnChannelShutdown(args);
            this.c_channel.BasicQos(0, this.c_configuration.ConsumerMessagePrefetchCount, false);

            this.c_logger.Info("ctor About to create consumer message processor");
            this.c_messageProcessor = new ConsumerMessageProcessor(this.c_configuration);

            this.c_logger.Info("ctor Completed");
        }
Пример #3
0
		public Consumer(
			IConnection connection,
			BusConfiguration configuration,
			CancellationToken cancellationToken)
		{
			this.c_logger = LogManager.GetLogger(this.GetType());
			this.c_logger.Info("ctor Starting");

			this.c_configuration = configuration;
			this.c_cancellationToken = cancellationToken;

			this.c_logger.Info("ctor About to create channel");
			this.c_channel = connection.CreateModel();
			this.c_channel.ModelShutdown += this.OnChannelShutdown;
			this.c_channel.BasicQos(0, this.c_configuration.ConsumerMessagePrefetchCount, false);

			this.c_logger.Info("ctor About to create consumer message processor");
			this.c_messageProcessor = new ConsumerMessageProcessor(this.c_configuration);

			this.c_logger.Info("ctor Completed");
		}