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


C# IEventStoreConnection.ConnectAsync方法代码示例

本文整理汇总了C#中IEventStoreConnection.ConnectAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IEventStoreConnection.ConnectAsync方法的具体用法?C# IEventStoreConnection.ConnectAsync怎么用?C# IEventStoreConnection.ConnectAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEventStoreConnection的用法示例。


在下文中一共展示了IEventStoreConnection.ConnectAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Nodes.ForEach(n => n.Start());

            _connection = EventStoreConnection.Create(ConnectionSettings.Default,
                ClusterSettings.Create()
                    .DiscoverClusterViaGossipSeeds()
                    .SetGossipSeedEndPoints(new[]
                    {
                        new IPEndPoint(IPAddress.Loopback, 10004), new IPEndPoint(IPAddress.Loopback, 20004),
                        new IPEndPoint(IPAddress.Loopback, 30004)
                    }));

            _connection.ConnectAsync().Wait();

            Console.WriteLine("Waiting for nodes to start");
            Console.WriteLine("CBA to write code for this - Go sort out projections then press enter to begin");
            Console.ReadLine();

            Node master = GetMaster();

            while (!AreProjectionsFuckedYet())
            {
                master = GetMaster();
                master.FuckOff();
                Thread.Sleep(15000);
            }

            Console.WriteLine("Projections fucked!!! (Master is {0}, previously {1})", GetMaster().Name, master.Name);
            Console.ReadLine();
            Nodes.ForEach(n => n.FuckOff());
        }
开发者ID:pgermishuys,项目名称:ClusterFuck,代码行数:32,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            using (_conn = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113)))
            {
                _conn.ConnectAsync().Wait();


                var config = ConfigurationFactory.ParseString(@"akka {  
                        actor {
                            provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                        }
                            remote {
                            helios.tcp {
                                port = 50000 #bound to a static port
                                hostname = localhost
                        }
                    }
                }");
                var system = ActorSystem.Create("atBatWriter", config); //akka.tcp://localhost:[email protected]/user

                var supervisor = system.ActorOf(AtBatSupervisor.Create(), "supervisor");

                Console.ReadLine();
            }
        }
开发者ID:DavidHoerster,项目名称:Agile.EventedBaseball,代码行数:25,代码来源:Program.cs

示例3: EventStoreProxy

        public EventStoreProxy(IComponentContext container)
        {
            _container = container;

            //Ensure we only set up the connection once
            lock (CreateConnectionLock)
            {
                if (_eventStoreConn == null)
                {
                    var connSettings = ConnectionSettings.Create()
                        .KeepReconnecting()
                        .KeepRetrying();

                    //TODO: get config value for address, port and user account
                    _eventStoreConn = EventStoreConnection.Create(connSettings, new IPEndPoint(IPAddress.Loopback, 1113));
                    _eventStoreConn.Disconnected += EventStoreConnDisconnected;
                    _eventStoreConn.ErrorOccurred += EventStoreConnErrorOccurred;
                    _eventStoreConn.Reconnecting += EventStoreConnReconnecting;
                    _eventStoreConn.Connected += EventStoreConnConnected;
                    _eventStoreConn.ConnectAsync().Wait();

                    SubscribeToStreamComment();
                    SubscribeToStreamTodo();
                }
            }
        }
开发者ID:nootn,项目名称:SampleFluxReactDotNet,代码行数:26,代码来源:EventStoreProxy.cs

示例4: Main

        static void Main(string[] args)
        {
            var system = ActorSystem.Create("playerComposition");

            var searcher = system.ActorOf(PlayerSearchSupervisor.Create(), "supervisor");

            //  akka://playerCOmposition/user/supervisor

            using (_conn = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113)))
            {
                _conn.ConnectAsync().Wait();

                Console.WriteLine("Player ID: ");
                var playerId = Console.ReadLine();

                for (int balls = 0; balls < 4; balls++)
                {
                    for (int strikes = 0; strikes < 3; strikes++)
                    {
                        var count = $"{balls}{strikes}";
                        searcher.Tell(new FindPlayerAndCount(playerId, count));
                    }
                }

                Console.ReadLine();
            }
        }
开发者ID:DavidHoerster,项目名称:Agile.EventedBaseball,代码行数:27,代码来源:Program.cs

示例5: TestFixtureSetUp

 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
     _node.Start();
     _conn = TestConnection.Create(_node.TcpEndPoint);
     _conn.ConnectAsync().Wait();
     When();
 }
开发者ID:nickman,项目名称:EventStore,代码行数:9,代码来源:SpecificationWithMiniNode.cs

示例6: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = BuildConnection(_node);
            _connection.ConnectAsync().Wait();
        }
开发者ID:czcz1024,项目名称:EventStore,代码行数:9,代码来源:when_working_with_stream_metadata_as_structured_info.cs

示例7: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.ConnectAsync().Wait();
        }
开发者ID:MariuszTrybus,项目名称:EventStore,代码行数:9,代码来源:when_working_with_stream_metadata_as_byte_array.cs

示例8: TestFixtureSetUp

 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
     _node.Start();
     _HttpEndPoint = _node.HttpEndPoint;
     _conn = BuildConnection(_node);
     _conn.ConnectAsync().Wait();
     Given();
     When();
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:11,代码来源:SpecificationWithMiniNode.cs

示例9: GetConnectionAsync

    public async Task<IEventStoreConnection> GetConnectionAsync() {
      if (Connection != null) return Connection;

      lock (BlockAllOtherThreads) {
        Connection = Factory.ConstructConnection();
      }
      Connection.Closed += OnClosed;
      await Connection.ConnectAsync().ConfigureAwait(false);

      return Connection;
    }
开发者ID:grrizzly,项目名称:eventsourced.net,代码行数:11,代码来源:Provider.cs

示例10: DispatcherBase

 public DispatcherBase(IMongoRepository mongoRepository, IGESConnection gesConnection, List<IHandler> eventHandlers)
 {
     _mongoRepository = mongoRepository;
     _gesConnection = gesConnection.BuildConnection();
     _gesConnection.ConnectAsync();
     _eventHandlers = eventHandlers;
     // add all handlers to the broadcast block so they receive news of events
     RegisterHandlers();
     // gets last event processed to avoid re processing events after a shut down.
     GetLastEventProcessedForHandlers();
 }
开发者ID:reharik,项目名称:EventSpike,代码行数:11,代码来源:DispatcherBase.cs

示例11: SetUp

        public void SetUp()
        {
            WebRequest.DefaultWebProxy = new WebProxy();
            _counter = 0;
            _directory = new SpecificationWithDirectoryPerTestFixture();
            _directory.TestFixtureSetUp();
            _node = new MiniNode(_directory.PathName, skipInitializeStandardUsersCheck: false, enableTrustedAuth: true);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.ConnectAsync().Wait();
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:12,代码来源:TestSuiteMarkerBase.cs

示例12: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _credentials = new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword);
            var createdMiniNode = false;
            _timeout = TimeSpan.FromSeconds(10);
            // Check if a node is running in ProjectionsManagerTestSuiteMarkerBase
            if (SetUpFixture.Connection != null && SetUpFixture.Node != null)
            {
                _tag = "_" + (++SetUpFixture.Counter);
                _node = SetUpFixture.Node;
                _connection = SetUpFixture.Connection;
            }
            else
            {
                createdMiniNode = true;
                _tag = "_1";

                _node = CreateNode();
                _node.Start();

                _connection = TestConnection.Create(_node.TcpEndPoint);
                _connection.ConnectAsync().Wait();
            }

            try
            {
                _projManager = new ProjectionsManager(new ConsoleLogger(), _node.ExtHttpEndPoint, _timeout);
                Given();
                When();
            }
            catch
            {
                if (createdMiniNode)
                {
                    if (_connection != null)
                    {
                        try {
                            _connection.Close();
                        } catch { 
                        }
                    }
                    if (_node != null)
                    {
                        try { 
                        	_node.Shutdown();
                        } catch {
                        }
                    }
                }
                throw;
            }
        }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:53,代码来源:SpecificationWithNodeAndProjectionsManager.cs

示例13: SetUp

        public void SetUp()
        {
            var typeName = GetType().Name.Length > 30 ? GetType().Name.Substring(0, 30) : GetType().Name;
            PathName = Path.Combine(Path.GetTempPath(), string.Format("{0}-{1}", Guid.NewGuid(), typeName));
            Directory.CreateDirectory(PathName);

            Counter = 0;
            CreateNode();

            Connection = TestConnection.Create(Node.TcpEndPoint);
            Connection.ConnectAsync().Wait();
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:12,代码来源:ProjectionsManagerTestSuiteMarkerBase.cs

示例14: SetUp

        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
            _node.Start();

            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.ConnectAsync().Wait();
            _conn.SetStreamMetadataAsync("$all", -1,
                                    StreamMetadata.Build().SetReadRole(SystemRoles.All),
                                    new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword)).Wait();
        }
开发者ID:MariuszTrybus,项目名称:EventStore,代码行数:12,代码来源:subscribe_to_all_should.cs

示例15: Connect

 private void Connect()
 {
     var settings = ConnectionSettings.Create();
     var ip = new IPEndPoint(_ipAddress, _port);
     Log("Connecting to {0}:{1}...", _ipAddress, _port);
     _connection = EventStoreConnection.Create(settings, ip);
     _connection.ConnectAsync();
     _connection.AppendToStreamAsync("hello", ExpectedVersion.Any, new EventData(Guid.NewGuid(), "Hello", false, new byte[0], new byte[0]));
     Log("Connected.");
     Log("Username to be used is: {0}", _userName);
     _credentials = new UserCredentials(_userName, _password);
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:12,代码来源:UpgradeProjectionsWorker.cs


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