本文整理汇总了C#中IEventStoreConnection.SubscribeToStreamFrom方法的典型用法代码示例。如果您正苦于以下问题:C# IEventStoreConnection.SubscribeToStreamFrom方法的具体用法?C# IEventStoreConnection.SubscribeToStreamFrom怎么用?C# IEventStoreConnection.SubscribeToStreamFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventStoreConnection
的用法示例。
在下文中一共展示了IEventStoreConnection.SubscribeToStreamFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureLines
static void MeasureLines(IEventStoreConnection con, UserCredentials credentials)
{
var stream = "lines_of_Budgets-a208105f_d5ba_475e_bb23_e7012945d332";
var w = Stopwatch.StartNew();
var sub = con.SubscribeToStreamFrom(stream, null, true, Appeared, Live, null, userCredentials);
mre.WaitOne();
w.Stop();
Console.WriteLine("read {0} events, in {1}. {2}", count, w.Elapsed, count / w.Elapsed.TotalSeconds);
Console.ReadLine();
}
示例2: Start
public void Start()
{
HasLoaded = false;
_connection = EventStore.ClientAPI.EventStoreConnection.Create(_endpoint);
var ct = _connection.ConnectAsync();
ct.Wait();
_checkPoint = Position.Start;
if (string.IsNullOrEmpty(_streamName))
_subscription = _connection.SubscribeToAllFrom(_checkPoint, false, EventAppeared, Live, SubscriptionDropped, _credentials);
else
_subscription = _connection.SubscribeToStreamFrom(_streamName, _lastEventNumber, true, EventAppeared, Live, SubscriptionDropped, _credentials);
}
示例3: Start
//TODO: Need restore point configuration
private static void Start(ProjectionGatewayConfiguration projectionGatewayConfiguration, IEventStoreConnection eventStoreConnection)
{
projectionGatewayConfiguration.Locator.Register(() => eventStoreConnection);
eventStoreConnection.ConnectAsync().Wait();
foreach (var subscription in projectionGatewayConfiguration.Subscriptions)
{
var eventHandlers = subscription.Value;
eventStoreConnection.SubscribeToStreamFrom(
stream: subscription.Key + "View",
lastCheckpoint: StreamCheckpoint.StreamStart,
resolveLinkTos: true,
eventAppeared: (upSubscription, @event) =>
{
var eventType = Type.GetType(@event.Event.EventType);
var deserializedEvent = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(@event.Event.Data), eventType);
eventHandlers
.Single(x => x.EventType == eventType)
.EventHandler(deserializedEvent);
});
}
}