/// <summary> /// Process windows of messages by relative time interval. /// </summary> /// <typeparam name="TSource">Type of source messages.</typeparam> /// <typeparam name="TOutput">Type of output messages.</typeparam> /// <param name="source">Source stream of messages.</param> /// <param name="relativeTimeInterval">The relative time interval over which to gather messages.</param> /// <param name="selector">Selector function.</param> /// <param name="deliveryPolicy">An optional delivery policy.</param> /// <param name="name">An optional name for the stream operator.</param> /// <returns>Output stream.</returns> public static IProducer <TOutput> Window <TSource, TOutput>( this IProducer <TSource> source, RelativeTimeInterval relativeTimeInterval, Func <IEnumerable <Message <TSource> >, TOutput> selector, DeliveryPolicy <TSource> deliveryPolicy = null, string name = nameof(Window)) { var window = new RelativeTimeWindow <TSource, TOutput>(source.Out.Pipeline, relativeTimeInterval, selector, name); return(PipeTo(source, window, deliveryPolicy)); }
/// <summary> /// Process windows of messages by relative time interval. /// </summary> /// <typeparam name="TSource">Type of source messages.</typeparam> /// <typeparam name="TOutput">Type of output messages.</typeparam> /// <param name="source">Source stream of messages.</param> /// <param name="relativeTimeInterval">The relative time interval over which to gather messages.</param> /// <param name="selector">Selector function.</param> /// <param name="waitForCompleteWindow">Whether to wait for the full window before output.</param> /// <param name="deliveryPolicy">An optional delivery policy.</param> /// <returns>Output stream.</returns> public static IProducer <TOutput> Window <TSource, TOutput>(this IProducer <TSource> source, RelativeTimeInterval relativeTimeInterval, Func <IEnumerable <Message <TSource> >, TOutput> selector, bool waitForCompleteWindow, DeliveryPolicy <TSource> deliveryPolicy = null) { var window = new RelativeTimeWindow <TSource, TOutput>(source.Out.Pipeline, relativeTimeInterval, selector, waitForCompleteWindow); return(PipeTo(source, window, deliveryPolicy)); }
/// <summary> /// Process windows of messages by relative time interval. /// </summary> /// <typeparam name="T">Type of source messages.</typeparam> /// <typeparam name="U">Type of output messages.</typeparam> /// <param name="source">Source stream of messages.</param> /// <param name="relativeTimeInterval">The relative time interval over which to gather messages.</param> /// <param name="selector">Selector function.</param> /// <param name="deliveryPolicy">An optional delivery policy.</param> /// <returns>Output stream.</returns> public static IProducer <U> Window <T, U>(this IProducer <T> source, RelativeTimeInterval relativeTimeInterval, Func <IEnumerable <Message <T> >, U> selector, DeliveryPolicy deliveryPolicy = null) { var window = new RelativeTimeWindow <T, U>(source.Out.Pipeline, relativeTimeInterval, selector); return(PipeTo(source, window, deliveryPolicy)); }