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


C# IBus.Defer方法代码示例

本文整理汇总了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
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:8,代码来源:Upgrade.cs

示例2: DeferForDateTime

        DeferForDateTime(IBus bus)
        {
            #region delayed-delivery-datetime

            bus.Defer(new DateTime(2016, 12, 25), new MessageToBeSentLater());

            #endregion
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:8,代码来源:DeferForDateTime.cs

示例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
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:9,代码来源:DeferForTimeSpan.cs

示例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
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:14,代码来源:DeferForTimeSpan.cs

示例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;
            }
        }

    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:45,代码来源:Program.cs

示例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");
 }
开发者ID:jh8848,项目名称:docs.particular.net,代码行数:6,代码来源:CommandSender.cs


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