当前位置: 首页>>代码示例>>C#>>正文


C# IEventStoreConnection.SubscribeToStreamFrom方法代码示例

本文整理汇总了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();
        }
开发者ID:valeriob,项目名称:MyBudget,代码行数:13,代码来源:Program.cs

示例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);

        }
开发者ID:valeriob,项目名称:MyBudget,代码行数:13,代码来源:InMemoryProjection.cs

示例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);
                    });
            }
        }
开发者ID:DrunkyBard,项目名称:CqrsMe,代码行数:23,代码来源:EventStoreProjectionConfigurationExtension.cs


注:本文中的IEventStoreConnection.SubscribeToStreamFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。