/// <summary> /// Sends a message together with a Sender PID, this allows the target to respond async to the Sender. /// This operation can be awaited. /// </summary> /// <param name="target">The target PID</param> /// <param name="message">The message to send</param> /// <param name="timeout">Timeout for the request</param> /// <typeparam name="T">Expected return message type</typeparam> /// <returns>A Task that completes once the Target Responds back to the Sender</returns> public static Task <T> RequestAsync <T>(this ISenderContext self, PID target, object message, TimeSpan timeout) => self.RequestAsync <T>(target, message, CancellationTokens.WithTimeout(timeout));
public static async Task <TResponse> Request <TResponse>(this ISenderContext context, PID pid, object message) => await context.RequestAsync <TResponse>(pid, message, 10.Seconds());
/// <summary> /// Sends a message together with a Sender PID, this allows the target to respond async to the Sender. /// This operation can be awaited. /// </summary> /// <param name="target">The target PID</param> /// <param name="message">The message to send</param> /// <typeparam name="T">Expected return message type</typeparam> /// <returns>A Task that completes once the Target Responds back to the Sender</returns> public static Task <T> RequestAsync <T>(this ISenderContext self, PID target, object message) => self.RequestAsync <T>(target, message, CancellationToken.None);