本文整理汇总了C#中IBus.Defer方法的典型用法代码示例。如果您正苦于以下问题:C# IBus.Defer方法的具体用法?C# IBus.Defer怎么用?C# IBus.Defer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBus
的用法示例。
在下文中一共展示了IBus.Defer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DelayedDelivery
void DelayedDelivery(IBus bus,object message)
{
#region 5to6delayed-delivery
bus.Defer(TimeSpan.FromMinutes(30), message);
// OR
bus.Defer(new DateTime(2016, 12, 25), message);
#endregion
}
示例2: DeferForDateTime
DeferForDateTime(IBus bus)
{
#region delayed-delivery-datetime
bus.Defer(new DateTime(2016, 12, 25), new MessageToBeSentLater());
#endregion
}
示例3: SendDelayedMessage
void SendDelayedMessage(BusConfiguration busConfiguration, IBus bus)
{
#region configure-persistence-timeout
busConfiguration.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
#endregion
#region delayed-delivery-timespan
bus.Defer(TimeSpan.FromMinutes(30), new MessageToBeSentLater());
#endregion
}
示例4: DeferForTimeSpan
DeferForTimeSpan(Configure configuration, IBus bus)
{
#region configure-persistence-timeout
configuration.UseInMemoryTimeoutPersister();
#endregion
#region delayed-delivery-timespan
bus.Defer(TimeSpan.FromMinutes(30), new MessageToBeSentLater());
#endregion
}
示例5: SendOrder
static void SendOrder(IBus bus)
{
Console.WriteLine("Press '1' to send PlaceOrder - defer message handling");
Console.WriteLine("Press '2' to send PlaceDelayedOrder - defer message delivery");
Console.WriteLine("Press enter key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
Guid id = Guid.NewGuid();
switch (key.Key)
{
case ConsoleKey.D1:
#region SendOrder
PlaceOrder placeOrder = new PlaceOrder
{
Product = "New shoes",
Id = id
};
bus.Send("Samples.DelayedDelivery.Server", placeOrder);
Console.WriteLine("[Defer Message Handling] Sent a new PlaceOrder message with id: {0}", id.ToString("N"));
#endregion
continue;
case ConsoleKey.D2:
#region DeferOrder
PlaceDelayedOrder placeDelayedOrder = new PlaceDelayedOrder
{
Product = "New shoes",
Id = id
};
bus.Defer(TimeSpan.FromSeconds(5), placeDelayedOrder);
Console.WriteLine("[Defer Message Delivery] Deferred a new PlaceDelayedOrder message with id: {0}", id.ToString("N"));
#endregion
continue;
case ConsoleKey.Enter:
return;
default:
return;
}
}
}
示例6: DeferMessage
static void DeferMessage(IBus bus)
{
bus.Defer(TimeSpan.FromSeconds(10), new DeferredMessage());
Console.WriteLine();
Console.WriteLine("{0} - {1}", DateTime.Now.ToLongTimeString(), "Sent a message that is deferred for 10 seconds");
}