本文整理汇总了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());
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
示例6: TestFixtureSetUp
public override void TestFixtureSetUp()
{
base.TestFixtureSetUp();
_node = new MiniNode(PathName);
_node.Start();
_connection = BuildConnection(_node);
_connection.ConnectAsync().Wait();
}
示例7: TestFixtureSetUp
public override void TestFixtureSetUp()
{
base.TestFixtureSetUp();
_node = new MiniNode(PathName);
_node.Start();
_connection = TestConnection.Create(_node.TcpEndPoint);
_connection.ConnectAsync().Wait();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
示例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);
}