CepStream.AlterEventDuration<TPayload> Method
Changes the duration of the input events. This method does not change the start time of an event.
Namespace: Microsoft.ComplexEventProcessing.Linq
Assembly: Microsoft.ComplexEventProcessing (in Microsoft.ComplexEventProcessing.dll)
Syntax
public static CepStream<TPayload> AlterEventDuration<TPayload>(
this CepStream<TPayload> source,
Expression<Func<CepEvent<TPayload>, TimeSpan>> eventDurationFunc
)
Type Parameters
- TPayload
Type of the input event payload.
Parameters
- source
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TPayload>
Input stream.
- eventDurationFunc
Type: System.Linq.Expressions.Expression<Func<CepEvent<TPayload>, TimeSpan>>
Expression that defines the new event duration.
Return Value
Type: Microsoft.ComplexEventProcessing.Linq.CepStream<TPayload>
A stream with new event durations.
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 sets the event duration to 1 hour.
// set event duration to 1 hour.
var onehour = inputStream.AlterEventDuration(e => TimeSpan.FromHours(1));
The following example sets the event duration to twice its current lifetime.
// double event duration.
var doubled = inputStream.AlterEventDuration(e => (e.EndTime - e.StartTime) * 2);