API Support for IObservable and IEnumerable in StreamInsight
This topic summarizes the API features in StreamInsight that support event sources and sinks that implement the IObservable or IEnumerable interfaces.
API support for observable and enumerable input
The following API features support event sources that implement the IObservable or IEnumerable interfaces.
Creating inputs
Creating bound inputs
Create an input stream that is bound to an application by using one of the following overloads for the Create method of the CepStream<TPayload> class.
Creating inputs from observable input
Translate an IObservable event source into an input stream by using one of the following overloads for the ToStream method of the ObservableCepStream class.
ToStream<TPayload>(IObservable<PointEvent<TPayload>>, Application, AdvanceTimeSettings, String)
ToStream<TPayload>(IObservable<IntervalEvent<TPayload>>, Application, AdvanceTimeSettings, String)
ToStream<TPayload>(IObservable<EdgeEvent<TPayload>>, Application, AdvanceTimeSettings, String)
Creating inputs from enumerable input
Translate an IEnumerable event source into an input stream by using one of the following overloads for the ToStream method of the CepStream class.
ToStream<TPayload>(IEnumerable<IntervalEvent<TPayload>>, Application, AdvanceTimeSettings, String)
ToStream<TPayload>(IEnumerable<EdgeEvent<TPayload>>, Application, AdvanceTimeSettings, String)
Describing the temporal characteristics
Describe the temporal characteristics of the source data by using one of the following helpers on the AdvanceTimeSettings class.
Mapping input to point, interval, and edge events
Map input data to point, interval or edge events by using the following methods in an expression passed to an overload of the ToStream method.
Mapping input to point events
Map input data to point events and the corresponding CTI events by using the following methods of the PointEvent or PointEvent<TPayload> class in an expression passed to an overload of the ToStream method.
Mapping input to interval events
Map input data to interval events and the corresponding CTI events by using the following methods of the IntervalEvent or IntervalEvent<TPayload> class in an expression passed to an overload of the ToStream method.
Creating edge events
Map input data to edge events and the corresponding CTI events by using the following methods of the EdgeEvent or EdgeEvent<TPayload> class in an expression passed to an overload of the ToStream method.
API support for observable and enumerable output
The following API features support event sinks that implement the IObservable or IEnumerable interfaces.
Creating outputs
Translate a stream of events into an IObservable output for a specific event shape by using one of the following methods of the ObservableCepStream class.
ToObservable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToPointObservable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToIntervalObservable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToEdgeObservable<TPayload>(CepStream<TPayload>, StreamEventOrder)
Translate a stream of events into an IEnumerable output for a specific event shape by using one of the following methods of the CepStream class.
ToEnumerable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToPointEnumerable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToIntervalEnumerable<TPayload>(CepStream<TPayload>, StreamEventOrder)
ToEdgeEnumerable<TPayload>(CepStream<TPayload>, StreamEventOrder)
Mapping output
Mapping observable output
Use the following methods of the ObservableCepStream to map observable output.
Select<TInput, TOutput>(ICepObservable<TInput>, Expression<Func<TInput, TOutput>>)
Where<TInput>(ICepObservable<TInput>, Expression<Func<TInput, Boolean>>)
Mapping enumerable output
Use the following methods of the CepStream to map enumerable output.
Select<TInput, TOutput>(ICepEnumerable<TInput>, Expression<Func<TInput, TOutput>>)
Where<TInput>(ICepEnumerable<TInput>, Expression<Func<TInput, Boolean>>)
Extended interfaces for event sinks
The methods described above for creating and filtering output return event sinks that implement interfaces that extend the base IObservable and IEnumerable interfaces. In particular, the extended interfaces let you provide a query name for debugging purposes.