当前位置: 首页>>代码示例>>C#>>正文


C# IServiceBus.Subscribe方法代码示例

本文整理汇总了C#中IServiceBus.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceBus.Subscribe方法的具体用法?C# IServiceBus.Subscribe怎么用?C# IServiceBus.Subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IServiceBus的用法示例。


在下文中一共展示了IServiceBus.Subscribe方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartService

		private void StartService()
		{
			StopService();

			try
			{
				
				_container = new DefaultMassTransitContainer("Server.Castle.xml");

				_bus = _container.Resolve<IServiceBus>("server");
				//_controlBus = _container.Resolve<IServiceBus>("control");

			    _container.AddComponent<UserAgentSession>();
			    _container.AddComponent<TheAnswerMan>();

				_bus.Subscribe<UserAgentSession>();
				_bus.Subscribe<TheAnswerMan>();

				messageTimer.Start();
			}
			catch (Exception ex)
			{
				_log.Error(ex);
				MessageBox.Show("The server failed to start:\n\n" + ex.Message);
			}
		}
开发者ID:KevM,项目名称:MassTransit,代码行数:26,代码来源:ServerForm.cs

示例2: Start

		public void Start(IServiceBus bus)
		{
			_bus = bus;
			_controlBus = bus.ControlBus;

			_unsubscribe += _controlBus.Subscribe<Acceptor<AvailableGridServiceNode>>();
			_unsubscribe += _controlBus.Subscribe<Learner<AvailableGridServiceNode>>();
		}
开发者ID:KevM,项目名称:MassTransit,代码行数:8,代码来源:GridServiceLoadBalancer.cs

示例3: Start

        public void Start()
        {
            _bus = ServiceLocator.Current.GetInstance<IServiceBus>("server");

            _bus.Subscribe<Responder>();
            _bus.Subscribe<RegisterUserSaga>();

            Console.WriteLine("Service running...");
        }
开发者ID:KevM,项目名称:MassTransit,代码行数:9,代码来源:AuditService.cs

示例4: Start

        public override void Start()
        {
            

            _bus = base.ServiceLocator.GetInstance<IServiceBus>("server");

            _bus.Subscribe<SendEmailConsumer>();

            Console.WriteLine("Service running...");
        }
开发者ID:KevM,项目名称:MassTransit,代码行数:10,代码来源:PostalServiceLifeCycle.cs

示例5: MainForm_Load

		private void MainForm_Load(object sender, EventArgs e)
		{
			_bus = ObjectFactory.GetInstance<IServiceBus>();
			_unsubscribe = _bus.Subscribe<SubTaskWorker<GenerateMandelbrotWorker, GenerateRow, RowGenerated>>();

			_worker = new BackgroundWorker();
			_worker.DoWork += worker_DoWork;
			_worker.RunWorkerCompleted += worker_RunWorkerCompleted;

			var task = new GenerateMandelbrotTask(_viewer.Width, _viewer.Height, 1000);

			_worker.RunWorkerAsync(task);
		}
开发者ID:KevM,项目名称:MassTransit,代码行数:13,代码来源:MainForm.cs

示例6: Start

        public void Start(IServiceBus bus)
        {
            _bus = bus;
            _bus.Subscribe<PasswordUpdater>();

            Console.WriteLine(new string('-', 20));
            Console.WriteLine("New Password Client");
            Console.WriteLine("What would you like to set your new password to?");
            Console.Write("New Password:");
            string newPassword = Console.ReadLine();

            Console.WriteLine(new string('-', 20));

            var message = new RequestPasswordUpdate(newPassword);

            _bus.Publish(message);

            Console.WriteLine("Waiting For Reply with CorrelationId '{0}'", message.CorrelationId);
            Console.WriteLine(new string('-', 20));
        }
开发者ID:shibukraj,项目名称:MassTransit,代码行数:20,代码来源:ClientService.cs

示例7: StartClient

        private void StartClient()
        {
            StopClient();

            try
            {
                _container = new DefaultMassTransitContainer("Client.Castle.xml");

                _bus = _container.Resolve<IServiceBus>("client");

                _container.AddComponent<TimeoutWatcher>();
                _bus.Subscribe<TimeoutWatcher>();
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                MessageBox.Show("The client failed to start:\n\n" + ex.Message);
            }
        }
开发者ID:KevM,项目名称:MassTransit,代码行数:19,代码来源:ClientForm.cs

示例8: Start

        public void Start()
        {
            _bus = ServiceLocator.Current.GetInstance<IServiceBus>("server");

        	_unsubscribeToken = _bus.Subscribe<InventoryLevelService>();
        }
开发者ID:KevM,项目名称:MassTransit,代码行数:6,代码来源:InternalInventoryServiceLifeCycle.cs

示例9: Start

 	public void Start()
     {
 		_bus = ServiceLocator.Current.GetInstance<IServiceBus>();
 		_unsubscribeAction = _bus.Subscribe<DrinkPreparationSaga>();
     }
开发者ID:KevM,项目名称:MassTransit,代码行数:5,代码来源:BaristaService.cs


注:本文中的IServiceBus.Subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。