本文整理汇总了C#中IEventStoreConnection类的典型用法代码示例。如果您正苦于以下问题:C# IEventStoreConnection类的具体用法?C# IEventStoreConnection怎么用?C# IEventStoreConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEventStoreConnection类属于命名空间,在下文中一共展示了IEventStoreConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventStoreEventPersistence
public EventStoreEventPersistence(
ILog log,
IEventStoreConnection connection)
{
_log = log;
_connection = connection;
}
示例2: PopulateRefData
//protected static readonly Serilog.ILogger Log = Log.ForContext<ReferenceDataHelper>();
public static async Task PopulateRefData(IEventStoreConnection eventStoreConnection)
{
Log.Information("Reference Writer Service starting...");
var repository = new Repository(eventStoreConnection, new EventTypeResolver(ReflectionHelper.ContractsAssembly));
Log.Information("Initializing Event Store with Currency Pair Data");
await new CurrencyPairInitializer(repository).CreateInitialCurrencyPairsAsync();
}
示例3: EventStoreConnectionLogicHandler
public EventStoreConnectionLogicHandler(IEventStoreConnection esConnection, ConnectionSettings settings)
{
Ensure.NotNull(esConnection, "esConnection");
Ensure.NotNull(settings, "settings");
_esConnection = esConnection;
_settings = settings;
_operations = new OperationsManager(_esConnection.ConnectionName, settings);
_subscriptions = new SubscriptionsManager(_esConnection.ConnectionName, settings);
_queue.RegisterHandler<StartConnectionMessage>(msg => StartConnection(msg.Task, msg.EndPointDiscoverer));
_queue.RegisterHandler<CloseConnectionMessage>(msg => CloseConnection(msg.Reason, msg.Exception));
_queue.RegisterHandler<StartOperationMessage>(msg => StartOperation(msg.Operation, msg.MaxRetries, msg.Timeout));
_queue.RegisterHandler<StartSubscriptionMessage>(StartSubscription);
_queue.RegisterHandler<EstablishTcpConnectionMessage>(msg => EstablishTcpConnection(msg.EndPoints));
_queue.RegisterHandler<TcpConnectionEstablishedMessage>(msg => TcpConnectionEstablished(msg.Connection));
_queue.RegisterHandler<TcpConnectionErrorMessage>(msg => TcpConnectionError(msg.Connection, msg.Exception));
_queue.RegisterHandler<TcpConnectionClosedMessage>(msg => TcpConnectionClosed(msg.Connection));
_queue.RegisterHandler<HandleTcpPackageMessage>(msg => HandleTcpPackage(msg.Connection, msg.Package));
_queue.RegisterHandler<TimerTickMessage>(msg => TimerTick());
_timer = new Timer(_ => EnqueueMessage(TimerTickMessage), null, Consts.TimerPeriod, Consts.TimerPeriod);
}
示例4: AsyncSnapshotReader
/// <summary>
/// Initializes a new instance of the <see cref="AsyncSnapshotReader"/> class.
/// </summary>
/// <param name="connection">The event store connection to use.</param>
/// <param name="configuration">The configuration to use.</param>
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="connection"/> or <paramref name="configuration"/> are <c>null</c>.</exception>
public AsyncSnapshotReader(IEventStoreConnection connection, SnapshotReaderConfiguration configuration)
{
if (connection == null) throw new ArgumentNullException("connection");
if (configuration == null) throw new ArgumentNullException("configuration");
_connection = connection;
_configuration = configuration;
}
示例5: EventStoreCatchUpSubscription
protected EventStoreCatchUpSubscription(IEventStoreConnection connection,
ILogger log,
string streamId,
bool resolveLinkTos,
UserCredentials userCredentials,
Action<EventStoreCatchUpSubscription, ResolvedEvent> eventAppeared,
Action<EventStoreCatchUpSubscription> liveProcessingStarted,
Action<EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped,
bool verboseLogging,
int readBatchSize = DefaultReadBatchSize,
int maxPushQueueSize = DefaultMaxPushQueueSize)
{
Ensure.NotNull(connection, "connection");
Ensure.NotNull(log, "log");
Ensure.NotNull(eventAppeared, "eventAppeared");
Ensure.Positive(readBatchSize, "readBatchSize");
Ensure.Positive(maxPushQueueSize, "maxPushQueueSize");
_connection = connection;
Log = log;
_streamId = string.IsNullOrEmpty(streamId) ? string.Empty : streamId;
_resolveLinkTos = resolveLinkTos;
_userCredentials = userCredentials;
ReadBatchSize = readBatchSize;
MaxPushQueueSize = maxPushQueueSize;
EventAppeared = eventAppeared;
_liveProcessingStarted = liveProcessingStarted;
_subscriptionDropped = subscriptionDropped;
Verbose = verboseLogging;
}
示例6: GetStreamMetadata
private static void GetStreamMetadata(IEventStoreConnection connection)
{
StreamMetadataResult metadata = connection.GetStreamMetadataAsync("test-stream").Result;
Console.WriteLine("cache control: " + metadata.StreamMetadata.CacheControl);
Console.WriteLine("custom value: " + metadata.StreamMetadata.GetValue<string>("key"));
Console.WriteLine("max age: " + metadata.StreamMetadata.MaxAge);
Console.WriteLine("max count: " + metadata.StreamMetadata.MaxCount);
}
示例7: AppendToStream
private static void AppendToStream(IEventStoreConnection connection)
{
byte[] data = Encoding.UTF8.GetBytes("event data");
byte[] metadata = Encoding.UTF8.GetBytes("event metadata");
EventData eventData = new EventData(Guid.NewGuid(), "testEvent", false, data, metadata);
connection.AppendToStreamAsync("test-stream", ExpectedVersion.Any, eventData).Wait();
}
示例8: DeviceSimulator
public DeviceSimulator(IEventStoreConnection connection, IConsole console)
{
if (connection == null) throw new ArgumentNullException("connection");
if (console == null) throw new ArgumentNullException("console");
_connection = connection;
_console = console;
}
示例9: 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());
}
示例10: Start
public void Start()
{
if (EmbeddedEventStoreConfiguration.RunWithLogging)
{
if (!Directory.Exists(EmbeddedEventStoreConfiguration.LogPath))
Directory.CreateDirectory(EmbeddedEventStoreConfiguration.LogPath);
LogManager.Init(string.Format("as-embed-es-{0}", DateTime.Now.Ticks), EmbeddedEventStoreConfiguration.LogPath);
}
var db = CreateTFChunkDb(EmbeddedEventStoreConfiguration.StoragePath);
var settings = CreateSingleVNodeSettings();
_node = new SingleVNode(db, settings, false, 0xf4240, new ISubsystem[0]);
var waitHandle = new ManualResetEvent(false);
_node.MainBus.Subscribe(new AdHocHandler<SystemMessage.BecomeMaster>(m => waitHandle.Set()));
_node.Start();
waitHandle.WaitOne();
_credentials = new UserCredentials("admin", "changeit");
_connection = EventStoreConnection.Create(
ConnectionSettings.Create().
EnableVerboseLogging().
SetDefaultUserCredentials(_credentials).
UseConsoleLogger(),
TcpEndPoint);
_connection.Connect();
}
示例11: SetUp
public void SetUp()
{
_connection = EmbeddedEventStore.Connection;
_configuration = EventReaderConfigurationFactory.Create();
_unitOfWork = new UnitOfWork();
_factory = AggregateRootEntityStub.Factory;
}
示例12: 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();
}
}
示例13: 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();
}
}
}
示例14: EventStoreHolder
EventStoreHolder(IHostConfiguration configuration, IBinarySerializer serializer)
{
var ipEndpoint = new IPEndPoint(configuration.EventStoreIp, configuration.EventStorePort);
_connection = EventStoreConnection.Create(ipEndpoint);
_serializer = serializer;
}
示例15: 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();
}
}