本文整理汇总了C#中IBus.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IBus.Dispose方法的具体用法?C# IBus.Dispose怎么用?C# IBus.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBus
的用法示例。
在下文中一共展示了IBus.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
var logger = new NullLogger();
bus = RabbitHutch.CreateBus("host=localhost", x => x.Register<IEasyNetQLogger>((y) => logger));
bus.Subscribe<SimpleMessage<string>>("Responder", HandleMessage);
Console.ReadLine();
bus.Dispose();
}
示例2: Main
static void Main(string[] args)
{
var logger = new NullLogger();
bus = RabbitHutch.CreateBus("host=localhost", x => x.Register<IEasyNetQLogger>((y) => logger));
var data = Enumerable.Range(1, 5).Select(x => x.ToString()).ToList();
bus.Subscribe<Message1>("First", HandleMessage);
bus.SubscribeAsync<Message2>("Second", x => Task.Factory.StartNew(() => AnotherMessage(x)));
Console.ReadLine();
bus.Publish(new Message1() { data = data });
Console.ReadLine();
bus.Dispose();
}
示例3: Main
static void Main()
{
IBus bus = null;
try
{
var random = new Random();
bus = BusFactory.Create();
var program = new Program(bus, random);
program.Run();
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
finally
{
Console.WriteLine("End simulation.");
Console.ReadKey();
if (bus != null)
bus.Dispose();
}
}
示例4: Shutdown
void Shutdown(IBus bus)
{
#region Hosting-Shutdown
bus.Dispose();
#endregion
}