CepStream.Join<TOuter, TInner, TKey, TResult> Method
Joins the events from the outer stream with events from the inner stream on the given join key.
Namespace: Microsoft.ComplexEventProcessing.Linq
Assembly: Microsoft.ComplexEventProcessing (in Microsoft.ComplexEventProcessing.dll)
Syntax
public static CepStream<TResult> Join<TOuter, TInner, TKey, TResult>(
this CepStream<TOuter> outer,
CepStream<TInner> inner,
Expression<Func<TOuter, TKey>> outerKeySelector,
Expression<Func<TInner, TKey>> innerKeySelector,
Expression<Func<TOuter, TInner, TResult>> selector
)
Type Parameters
- TOuter
Outer stream event type.
- TInner
Inner stream event type.
- TKey
Join key type.
- TResult
Join result type.
Parameters
- outer
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TOuter>
The outer stream.
- inner
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TInner>
The inner stream.
- outerKeySelector
Type: System.Linq.Expressions.Expression<Func<TOuter, TKey>>
Selector to select the key values from outer stream event.
- innerKeySelector
Type: System.Linq.Expressions.Expression<Func<TInner, TKey>>
Selector to select the key value from inner stream event.
- selector
Type: System.Linq.Expressions.Expression<Func<TOuter, TInner, TResult>>
Mapping expression that defines a projection on the output.
Return Value
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TResult>
A stream of joined events.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type CepStream<TOuter>. 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).
Remarks
For more information, see Joins.
Examples
The following example compares events in stream stream1 with events in stream stream2. Events in the stream that meet the equality criteria defined in the on clause (in addition to overlap in the time intervals of the two events) are joined and output into a new event that contains the payload fields i and j from event e1 and field j from event e2.
// Assuming the following input event type for both stream1 and stream2.
public class MyPayload
{
public int i;
public float j;
}
var equiJoin = from e1 in stream1
join e2 in stream2
on e1.i equals e2.i
select new { e1.i, e1.j, e2.j };