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


C# Bus.Start方法代码示例

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


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

示例1: Given

        protected virtual async Task Given(IConfigurationScenario<BusBuilderConfiguration> scenario)
        {
            Instance = scenario.CreateInstance();
            Reconfigure();

            Bus = Instance.Configuration.Build();
            MethodCallCounter = MethodCallCounter.CreateInstance(Bus.InstanceId);
            await Bus.Start();
        }
开发者ID:NimbusAPI,项目名称:Nimbus,代码行数:9,代码来源:TestForBus.cs

示例2: OnStart

        public Task OnStart()
        {
            // Make sure the bus is started
            _bus = _container.Resolve<Bus>();
            Task startBus = _bus.Start();

            // Execute the scheduler that we can cancel on stop
            _schedulerExecution = _container.Resolve<SampleDataJobScheduler>().Run(_cancelTokenSource.Token);

            return startBus;
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:11,代码来源:WorkerRole.cs

示例3: Start_InputQueueSet_RegisterTransportListener

        public void Start_InputQueueSet_RegisterTransportListener()
        {
            string queueName = "myQueue";

            var transport = A.Fake<ITransport>();
            var bus = new Bus(queueName) { Transport = transport };

            bus.Start();

            A.CallTo(() => transport.StartListen(queueName)).MustHaveHappened(Repeated.Exactly.Once);
        }
开发者ID:malmgren80,项目名称:TucTuc,代码行数:11,代码来源:BusTests.cs

示例4: Send_Null_Throws

        public void Send_Null_Throws()
        {
            var transport = A.Fake<ITransport>();

            var bus = new Bus("myQueue");

            bus.Transport = transport;

            bus.Start();

            Assert.Throws<ArgumentNullException>(() => bus.Send<string>(null));
        }
开发者ID:malmgren80,项目名称:TucTuc,代码行数:12,代码来源:BusTests.cs

示例5: Create

		public Cumulus.IBus Create(string connectionString, string name)
		{
			_bus = new BusBuilder().Configure()
								   .WithConnectionString(connectionString)
								   .WithNames(name, Environment.MachineName)
								   .WithTypesFrom(_typeProvider)
								   .WithDefaultTimeout(TimeSpan.FromSeconds(30))
								   .WithUnityDependencyResolver(_typeProvider, _container)
								   .Build();
			_bus.Start()
                .Wait();

			return _bus;
		}
开发者ID:AtmosphereMessaging,项目名称:Cumulus,代码行数:14,代码来源:BusFactory.cs

示例6: Send_NoEndpointForType_Throws

        public void Send_NoEndpointForType_Throws()
        {
            var transport = A.Fake<ITransport>();

            var bus = new Bus("myQueue");

            bus.Transport = transport;

            bus.Start();

            string someData = "some made up data";

            Assert.Throws<InvalidOperationException>(() => bus.Send(someData));
        }
开发者ID:malmgren80,项目名称:TucTuc,代码行数:14,代码来源:BusTests.cs

示例7: Given

        protected virtual async Task Given(IConfigurationScenario<BusBuilderConfiguration> scenario)
        {
            _instance = scenario.CreateInstance();
            _numMessagesSent = 0;

            var busBuilderConfiguration = _instance.Configuration;

            var logger = Debugger.IsAttached
                ? TestHarnessLoggerFactory.Create(Guid.NewGuid(), GetType().FullName)
                : new NullLogger();
            busBuilderConfiguration.WithLogger(logger);

            Bus = busBuilderConfiguration.Build();
            Log.Debug("Starting bus...");
            await Bus.Start();
            Log.Debug("Bus started.");
        }
开发者ID:NimbusAPI,项目名称:Nimbus,代码行数:17,代码来源:ThroughputSpecificationForBus.cs

示例8: Given

        protected virtual async Task Given(IConfigurationScenario<BusBuilderConfiguration> scenario)
        {
            _instance = scenario.CreateInstance();
            _numMessagesSent = 0;

            var busBuilderConfiguration = _instance.Configuration;

            if (!Debugger.IsAttached)
            {
                busBuilderConfiguration.WithLogger(new NullLogger());
            }

            Bus = busBuilderConfiguration.Build();
            Log.Debug("Starting bus...");
            await Bus.Start();
            Log.Debug("Bus started.");
        }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:17,代码来源:ThroughputSpecificationForBus.cs

示例9: Main

        static void Main(string[] args)
        {
            var message = new DummyMessage { Text = "Hello from Tuc Tuc!" };

            string queue = Path.Combine(Path.GetTempPath(), "TucTuc");

            var bus = new Bus(queue);
            bus.RegisterEndpoint<DummyMessage>(queue);
            bus.RegisterMessageHandler<DummyMessage>(m => Handle(m));

            bus.Start();

            while(true)
            {
                bus.Send(message);

                Thread.Sleep(60000);
            }
        }
开发者ID:malmgren80,项目名称:TucTuc,代码行数:19,代码来源:Program.cs

示例10: should_stop_dispatcher_before_transport

        public void should_stop_dispatcher_before_transport()
        {
            var transportMock = new Mock<ITransport>();
            var bus = new Bus(transportMock.Object, _directoryMock.Object, _messageSerializer, _messageDispatcherMock.Object, new DefaultStoppingStrategy());
            var sequence = new SetupSequence();
            _messageDispatcherMock.Setup(dispatch => dispatch.Stop()).InSequence(sequence);
            transportMock.Setup(transport => transport.Stop()).InSequence(sequence);
            bus.Configure(_self.Id, "test");

            bus.Start();
            bus.Stop();
            sequence.Verify();
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:13,代码来源:BusTests.Dispatch.cs


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