/// <summary> /// Exports a streamable as an observable of events. Produces events that are sync time ordered. /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TPayload"></typeparam> /// <param name="stream"></param> /// <param name="reshapingPolicy">Policy that specifies whether and how events are reshaped at egress. Default passes events through unmodified.</param> /// <returns></returns> public static IObservable <ArraySegment <PartitionedStreamEvent <TKey, TPayload> > > ToStreamEventArrayObservable <TKey, TPayload>( this IStreamable <PartitionKey <TKey>, TPayload> stream, ReshapingPolicy reshapingPolicy = ReshapingPolicy.None) { Invariant.IsNotNull(stream, nameof(stream)); return(stream.ToStreamEventArrayObservable( () => new PartitionedStreamEvent <TKey, TPayload> [Config.DataBatchSize], null, Guid.NewGuid().ToString(), reshapingPolicy)); }
/// <summary> /// Exports a streamable as an observable of events. Produces events that are sync time ordered. /// </summary> /// <typeparam name="TPayload"></typeparam> /// <param name="stream"></param> /// <param name="generator">A function that returns an array that will be populated with stream results.</param> /// <param name="reshapingPolicy">Policy that specifies whether and how events are reshaped at egress. Default passes events through unmodified.</param> /// <returns></returns> public static IObservable <ArraySegment <StreamEvent <TPayload> > > ToStreamEventArrayObservable <TPayload>( this IStreamable <Empty, TPayload> stream, Func <StreamEvent <TPayload>[]> generator, ReshapingPolicy reshapingPolicy = ReshapingPolicy.None) { Invariant.IsNotNull(stream, nameof(stream)); return(stream.ToStreamEventArrayObservable( generator, null, Guid.NewGuid().ToString(), reshapingPolicy)); }
/// <summary> /// Exports a streamable as an observable of events. Produces events that are sync time ordered. /// </summary> /// <typeparam name="TPayload"></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="reshapingPolicy">Policy that specifies whether and how events are reshaped at egress. Default passes events through unmodified.</param> /// <returns></returns> public static IObservable <ArraySegment <StreamEvent <TPayload> > > RegisterArrayOutput <TPayload>( this QueryContainer container, IStreamable <Empty, TPayload> stream, ReshapingPolicy reshapingPolicy = ReshapingPolicy.None, string identifier = null) { Invariant.IsNotNull(stream, nameof(stream)); return(stream.ToStreamEventArrayObservable( () => new StreamEvent <TPayload> [Config.DataBatchSize], container, identifier ?? Guid.NewGuid().ToString(), reshapingPolicy)); }
/// <summary> /// Exports a streamable as an observable of events. Produces events that are sync time ordered. /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TPayload"></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="generator">A function that returns an array that will be populated with stream results.</param> /// <param name="reshapingPolicy">Policy that specifies whether and how events are reshaped at egress. Default passes events through unmodified.</param> /// <returns></returns> public static IObservable <ArraySegment <PartitionedStreamEvent <TKey, TPayload> > > RegisterArrayOutput <TKey, TPayload>( this QueryContainer container, IStreamable <PartitionKey <TKey>, TPayload> stream, Func <PartitionedStreamEvent <TKey, TPayload>[]> generator, ReshapingPolicy reshapingPolicy = ReshapingPolicy.None, string identifier = null) { Invariant.IsNotNull(stream, nameof(stream)); return(stream.ToStreamEventArrayObservable( generator, container, identifier ?? Guid.NewGuid().ToString(), reshapingPolicy)); }