예제 #1
0
 /// <summary>
 /// Previous message nth back.
 /// </summary>
 /// <typeparam name="T">Type of source messages.</typeparam>
 /// <param name="source">Source stream.</param>
 /// <param name="index">Index of previous message (nth back).</param>
 /// <param name="policy">Delivery policy.</param>
 /// <returns>Output stream.</returns>
 public static IProducer <T> Previous <T>(this IProducer <T> source, int index, DeliveryPolicy policy = null)
 {
     return(source.History(index + 1, policy).Where(b => b.Count() == index + 1, policy).Select(b => b.ElementAt(0), policy));
 }