本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}
示例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));
}
示例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.");
}
示例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.");
}
示例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);
}
}
示例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();
}