コード例 #1
0
ファイル: Closed.cs プロジェクト: pmcgrath/PMCG.Messaging
		public Closed(
			BusConfiguration configuration,
			IConnectionManager connectionManager,
			IBusContext context)
			: base(configuration, connectionManager, context)
		{
			base.Logger.Info("ctor Completed");
		}
コード例 #2
0
		public ConsumerMessageProcessor(
			BusConfiguration configuration)
		{
			this.c_logger = LogManager.GetLogger(this.GetType());
			this.c_logger.Info("ctor Starting");
			
			this.c_configuration = configuration;
			this.c_logger.Info("ctor Completed");
		}
コード例 #3
0
ファイル: Consumer.cs プロジェクト: pmcgrath/PMCG.Messaging
		public void InstantiateAndStartConsumer(
			BusConfiguration busConfiguration)
		{
			this.c_connection = new ConnectionFactory { Uri = busConfiguration.ConnectionUris.First() }.CreateConnection();
			this.c_cancellationTokenSource = new CancellationTokenSource();

			this.c_consumer = new PMCG.Messaging.Client.Consumer(
				this.c_connection,
				busConfiguration,
				this.c_cancellationTokenSource.Token);
			this.c_consumer.Start();
		}
コード例 #4
0
		public void SetUp()
		{
			var _busConfigurationBuilder = new BusConfigurationBuilder();
			_busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri);
			_busConfigurationBuilder.ConsumerDequeueTimeout = TimeSpan.FromMilliseconds(20);
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				typeof(MyEvent).Name,
				message =>
					{
						return ConsumerHandlerResult.Completed;
					});
			this.c_busConfiguration = _busConfigurationBuilder.Build();

			this.c_connection = Substitute.For<IConnection>();
			this.c_channel = Substitute.For<IModel>();
			this.c_cancellationTokenSource = new CancellationTokenSource();

			this.c_connection.CreateModel().Returns(this.c_channel);
		}
コード例 #5
0
ファイル: Consumer.cs プロジェクト: pmcgrath/PMCG.Messaging
		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");
		}