CepStream.ShiftEventTime<TPayload> Method (CepStream<TPayload>, Expression<Func<CepEvent, DateTime>>)
Shifts the event start time to a new time stamp without changing the lifetime.
Namespace: Microsoft.ComplexEventProcessing.Linq
Assembly: Microsoft.ComplexEventProcessing (in Microsoft.ComplexEventProcessing.dll)
Syntax
public static CepStream<TPayload> ShiftEventTime<TPayload>(
this CepStream<TPayload> source,
Expression<Func<CepEvent, DateTime>> shiftExpr
)
Type Parameters
- TPayload
Type of the input event payload.
Parameters
- source
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TPayload>
Input stream.
- shiftExpr
Type: System.Linq.Expressions.Expression<Func<CepEvent, DateTime>>
Expression that defines the new start time.
Return Value
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TPayload>
A stream with shifted event start times.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type CepStream<TPayload>. 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 Time Stamp Modifications.
Examples
The following example shifts the start time of each event in the stream by 15 minutes into the future.
// shift events by 15 minutes into the future.
var shifted = inputStream.ShiftEventTime(e => e.StartTime + TimeSpan.FromMinutes(15));
The following example shifts the start time of each event in the stream by 1 hour into the past.
// shift events by 1 hour into the past.
var shifted = inputStream.ShiftEventTime(e => e.StartTime - TimeSpan.FromHours(1));