Пример #1
0
 /// <summary>
 /// Publish a message for any listening subscribers, delayed.
 /// </summary>
 /// <remarks>
 /// This should be used from within a process' message loop only
 /// This will fail to be accurate across a Daylight Saving Time boundary
 /// </remarks>
 /// <param name="message">Message to publish</param>
 /// <param name="delayUntil">When to send</param>
 /// <returns>IDisposable that you can use to cancel the operation if necessary.  You do not need to call Dispose
 /// for any other reason.</returns>
 public static IDisposable publish <T>(T message, DateTime delayUntil) =>
 InMessageLoop
         ? safedelay(() => ActorContext.Publish(message), delayUntil)
         : raiseUseInMsgLoopOnlyException <IDisposable>(nameof(publish));
Пример #2
0
 /// <summary>
 /// Publish a message for any listening subscribers
 /// </summary>
 /// <remarks>
 /// This should be used from within a process' message loop only
 /// </remarks>
 /// <param name="message">Message to publish</param>
 public static Unit publish <T>(T message) =>
 InMessageLoop
         ? ActorContext.Publish(message)
         : raiseUseInMsgLoopOnlyException <Unit>(nameof(publish));