Esempio n. 1
0
 /// <summary>
 /// Sends the command message when the specified task completes successfully. See also <seealso cref="RockMessageBus.SendAsync{TQueue, TMessage}(TMessage)" />
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="completionTask">The task to wait for before sending the message</param>
 public static void SendWhen(this BusStartedTaskMessage message, Task <bool> completionTask)
 {
     Task.Run(async() =>
     {
         // Wait for specified task to complete, then send the message if the task completed successfully
         var completedSuccessfully = await completionTask;
         if (completedSuccessfully)
         {
             message.Send();
         }
     });
 }
Esempio n. 2
0
 /// <summary>
 /// Sends the messages to the bus.
 /// </summary>
 public static void Send(this BusStartedTaskMessage message)
 {
     _ = RockMessageBus.SendAsync(message, message.GetType());
 }