-
Notifications
You must be signed in to change notification settings - Fork 2k
/
GeneratedBatchContainer.cs
42 lines (36 loc) · 1.26 KB
/
GeneratedBatchContainer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using Orleans.Providers.Streams.Common;
using Orleans.Streams;
namespace Orleans.Providers.Streams.Generator
{
public class GeneratedBatchContainer : IBatchContainer
{
public Guid StreamGuid { get; }
public string StreamNamespace { get; }
public StreamSequenceToken SequenceToken => RealToken;
public EventSequenceTokenV2 RealToken { get; }
public DateTime EnqueueTimeUtc { get; }
public object Payload { get; }
public GeneratedBatchContainer(Guid streamGuid, string streamNamespace, object payload, EventSequenceTokenV2 token)
{
StreamGuid = streamGuid;
StreamNamespace = streamNamespace;
EnqueueTimeUtc = DateTime.UtcNow;
this.Payload = payload;
this.RealToken = token;
}
public IEnumerable<Tuple<T, StreamSequenceToken>> GetEvents<T>()
{
return new[] { Tuple.Create((T)Payload, SequenceToken) };
}
public bool ImportRequestContext()
{
return false;
}
public bool ShouldDeliver(IStreamIdentity stream, object filterData, StreamFilterPredicate shouldReceiveFunc)
{
return true;
}
}
}