예제 #1
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="stream"></param>
        /// <param name="constructor">Method description that constructs result data from the start time and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <TResult> ToTemporalObservable <TPayload, TResult>(
            this IStreamable <Empty, TPayload> stream,
            Expression <Func <long, TPayload, TResult> > constructor)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalObservable(
                       constructor, null, Guid.NewGuid().ToString()));
        }
예제 #2
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge and interval events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="container">The query container to which an egress point is being added.</param>
        /// <param name="identifier">A string that can uniquely identify the point of egress in the query.</param>
        /// <param name="stream"></param>
        /// <param name="constructor">Method description that constructs result data from the start time, end time, and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <TResult> RegisterTemporalOutput <TKey, TPayload, TResult>(
            this QueryContainer container,
            IStreamable <PartitionKey <TKey>, TPayload> stream,
            Expression <Func <TKey, long, long, TPayload, TResult> > constructor,
            string identifier = null)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalObservable(
                       constructor, container, identifier ?? Guid.NewGuid().ToString()));
        }