Share via


DynamicQueryCompositionExtensions.ToStream<TPayload> Method (Query)

Creates a new input stream bound to the output event stream of an existing query.

Namespace:  Microsoft.ComplexEventProcessing
Assembly:  Microsoft.ComplexEventProcessing (in Microsoft.ComplexEventProcessing.dll)

Syntax

public static CepStream<TPayload> ToStream<TPayload>(
    this Query query
)

Type Parameters

  • TPayload
    Type of the payload for the new stream.

Parameters

Return Value

Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TPayload>
An instance of the CepStream class that can be used to create new queries.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Query. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=sql.105) or https://msdn.microsoft.com/en-us/library/bb383977(v=sql.105).

Examples

Application myApp = server.CreateApplication("MyApp");
var inputstream = CepStream<TPayload>.Create("inputStream", typeof(InputFactory), inConf, EventShape.Point);
var filtered = from e in inputstream
               where e.Value > 25
               select e;
var query = filtered.ToQuery(myApp, "filterQuery", "", typeof(OutputFactory), outConf, EventShape.Point, StreamEventOrder.FullyOrdered);
var filteredStream = query.ToStream<TPayload>();
var validated = from e in filteredStream
                select new
                {
                    SourceId = e.SourceId,
                    Value = e.Value,
                    Status = e.Value > 75 ? false : true
                };
var validationQuery = validated.ToQuery("validationQuery", "", typeof(OutputFactory), outConf2, EventShape.Point, StreamEventOrder.FullyOrdered);

See Also

Reference

DynamicQueryCompositionExtensions Class

ToStream Overload

Microsoft.ComplexEventProcessing Namespace