コード例 #1
1
 public EventStoreEventPersistence(
     ILog log,
     IEventStoreConnection connection)
 {
     _log = log;
     _connection = connection;
 }
コード例 #2
0
        EventStoreHolder(IHostConfiguration configuration, IBinarySerializer serializer)
        {
            var ipEndpoint = new IPEndPoint(configuration.EventStoreIp, configuration.EventStorePort);

            _connection = EventStoreConnection.Create(ipEndpoint);
            _serializer = serializer;
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 /// <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
0
        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();
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: pgermishuys/ClusterFuck
        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 f****d!!! (Master is {0}, previously {1})", GetMaster().Name, master.Name);
            Console.ReadLine();
            Nodes.ForEach(n => n.FuckOff());
        }
コード例 #7
0
        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();
                }
            }
        }
コード例 #8
0
        //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();
        }
コード例 #9
0
        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:50000@atBatWriter/user

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

                Console.ReadLine();
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: rcknight/AppDotNetEvents
        public PostImporter()
        {
            _checkpoint = new FileCheckpoint("postsLoaded");

            _logger = new EventStore.ClientAPI.Common.Log.ConsoleLogger();

            var _connectionSettings =
                ConnectionSettings.Create()
                                  .UseConsoleLogger()
                                  .KeepReconnecting()
                                  .KeepRetrying()
                                  .OnConnected(_ => _logger.Info("Event Store Connected"))
                                  .OnDisconnected(_ => _logger.Error("Event Store Disconnected"))
                                  .OnReconnecting(_ => _logger.Info("Event Store Reconnecting"))
                                  .OnErrorOccurred((c, e) => _logger.Error(e, "Event Store Error :("));

            _connection = EventStoreConnection.Create(_connectionSettings, new IPEndPoint(IPAddress.Parse("192.81.222.61"), 1113));
            _connection.Connect();

            ThreadPool.SetMaxThreads(20, 20);
            ThreadPool.SetMinThreads(20, 20);
            //ServicePointManager.DefaultConnectionLimit = 1000;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.ServerCertificateValidationCallback = Validator;
            //ServicePointManager.EnableDnsRoundRobin = false;
            //ServicePointManager.DnsRefreshTimeout = Int32.MaxValue;
        }
コード例 #12
0
        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;
        }
        public GetEventStoreAggregateRepositoryTests()
        {
            _id = "aggregate-" + Guid.NewGuid().ToString("n");
            var source = new TaskCompletionSource<bool>();
            _eventStoreInitialized = source.Task;
            var notListening = new IPEndPoint(IPAddress.None, 0);
            _node = EmbeddedVNodeBuilder
                .AsSingleNode()
                .WithExternalTcpOn(notListening)
                .WithInternalTcpOn(notListening)
                .WithExternalHttpOn(notListening)
                .WithInternalHttpOn(notListening)
                .RunProjections(ProjectionsMode.All);
            _node.NodeStatusChanged += (_, e) =>
            {
                if (e.NewVNodeState != VNodeState.Master)
                {
                    return;
                }
                source.SetResult(true);
            };
            _connection = EmbeddedEventStoreConnection.Create(_node);
            _sut = new GetEventStoreAggregateRepository(_connection, new DefaultGetEventStoreJsonSerializer());

            _node.Start();
        }
コード例 #14
0
 public void SetUp()
 {
     _connection = EmbeddedEventStore.Connection;
     _configuration = EventReaderConfigurationFactory.Create();
     _unitOfWork = new UnitOfWork();
     _factory = AggregateRootEntityStub.Factory;
 }
コード例 #15
0
 public void TearDown()
 {
     _connection.Close();
     _node.Shutdown();
     _connection = null;
     _node = null;
     _directory.TestFixtureTearDown();
 }
コード例 #16
0
 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);
 }
コード例 #17
0
        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();
        }
コード例 #18
0
 public void SetUp()
 {
     _connection = EmbeddedEventStore.Instance.Connection;
     _reader = AsyncSnapshotReaderFactory.Create();
     _configuration = EventReaderConfigurationFactory.Create();
     _unitOfWork = new ConcurrentUnitOfWork();
     _factory = SnapshotableAggregateRootEntityStub.Factory;
 }
コード例 #19
0
ファイル: IndexingServie.cs プロジェクト: jrgcubano/CQRSShop
 private void ConnectToEventstore()
 {
     _latestPosition = Position.Start;
     _connection = EventStoreConnectionWrapper.Connect();
     _connection.Connected +=
         (sender, args) => _connection.SubscribeToAllFrom(_latestPosition, false, HandleEvent);
     Console.WriteLine("Indexing service started");
 }
コード例 #20
0
        public DeviceSimulator(IEventStoreConnection connection, IConsole console)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (console == null) throw new ArgumentNullException("console");

            _connection = connection;
            _console = console;
        }
コード例 #21
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _conn = EventStoreConnection.Create(_node.TcpEndPoint);
            _conn.ConnectAsync().Wait();
        }
コード例 #22
0
 public OuroStreamFactory(
     ILogger<IEventStore> logger,
     IEventStoreConnection eventStore,
     UserCredentials credentials)
 {
     _logger = logger;
     _eventStore = eventStore;
     _credentials = credentials;
 }
コード例 #23
0
        public MeasurementReadCounterQuery(IEventStoreConnection connection, IProjectionContext projectionContext, IConsole console)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (console == null) throw new ArgumentNullException("console");

            _connection = connection;
            _projectionContext = projectionContext;
            _console = console;
        }
コード例 #24
0
 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
     _node.Start();
     _conn = TestConnection.Create(_node.TcpEndPoint);
     _conn.Connect();
     When();
 }
 public EventFactory(UserCredentials credentials, IEventStoreConnection connection)
 {
     _closedEvent = new ClosedEvent(credentials, connection);
     _openedEvent = new OpenedEvent(credentials, connection);
     _registerBreakerEvent = new RegisterBreakerEvent(credentials, connection);
     _tryingToCloseEvent = new TryingToCloseEvent(credentials, connection);
     _unregisterBreakerEvent = new UnregisterBreakerEvent(credentials, connection);
     _tolleratedOpenEvent = new TolleratedOpenEvent(credentials, connection);
 }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();
        }
コード例 #27
0
        public void TearDown()
        {
            Connection.Close();
            Node.Shutdown();
            Connection = null;
            Node = null;

            Directory.Delete(PathName, true);
        }
コード例 #28
0
 public static Repository<User> Create(UnitOfWork unitOfWork, IEventStoreConnection connection, UserCredentials credentials)
 {
     return new Repository<User>(() => User.Factory(), unitOfWork, connection,
                                 new EventReaderConfiguration(
                                     new SliceSize(512),
                                     new JsonDeserializer(),
                                     new PassThroughStreamNameResolver(),
                                     new FixedStreamUserCredentialsResolver(credentials)));
 }
コード例 #29
0
ファイル: EventStore.cs プロジェクト: valeriob/MyBudget
        public EventStore(IPEndPoint endpoint, UserCredentials credentials, IAdaptEvents adapter)
        {
            _endpoint = endpoint;
            _credentials = credentials;
            _adapter = adapter;

            _con = EventStoreConnection.Create(endpoint);
            _con.Connect();
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = BuildConnection(_node);
            _connection.ConnectAsync().Wait();
        }
コード例 #31
0
 public GesRepository(IEventStoreConnection connection, IAggregateFactory factory)
 {
     this.connection = connection;
     this.factory    = factory;
 }
コード例 #32
0
 /// <summary>
 /// CounterCommand constructor that calls the base constructor
 /// </summary>
 /// <param name="conn"></param>
 public CounterCommand(IEventStoreConnection conn) : base(conn)
 {
 }
コード例 #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:MicroServices.Common.Repository.EventStoreRepository"/> class.
 /// </summary>
 /// <param name="eventStoreConnection">Event store connection.</param>
 /// <param name="bus">Bus.</param>
 public EventStoreRepository(IEventStoreConnection eventStoreConnection, IMessageBus bus)
 {
     this.eventStoreConnection = eventStoreConnection;
     this.bus = bus;
 }
コード例 #34
0
 public EventStoreService(IConfiguration _configuration)
 {
     // essa conexão tem que er imutável por isso ela é um singleton em startup
     _connection = EventStoreConnection.Create(_configuration.GetConnectionString("EventStoreConnection"));
     _connection.ConnectAsync();
 }
コード例 #35
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName, enableTrustedAuth: true);
            _node.Start();

            var userCreateEvent1 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                userCreateEvent1.Set();
            }), SystemAccount.Principal, "user1", "Test User 1", new string[0], "pa$$1"));

            var userCreateEvent2 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                userCreateEvent2.Set();
            }), SystemAccount.Principal, "user2", "Test User 2", new string[0], "pa$$2"));

            var adminCreateEvent2 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                adminCreateEvent2.Set();
            }), SystemAccount.Principal, "adm", "Administrator User", new[] { SystemRoles.Admins }, "admpa$$"));

            Assert.IsTrue(userCreateEvent1.Wait(120000), "User 1 creation failed");
            Assert.IsTrue(userCreateEvent2.Wait(120000), "User 2 creation failed");
            Assert.IsTrue(adminCreateEvent2.Wait(120000), "Administrator User creation failed");

            Connection = TestConnection.Create(_node.TcpEndPoint, TcpType.Normal, _userCredentials);
            Connection.Connect();

            Connection.SetStreamMetadata("noacl-stream", ExpectedVersion.NoStream, StreamMetadata.Build());
            Connection.SetStreamMetadata("read-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetReadRole("user1"));
            Connection.SetStreamMetadata("write-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetWriteRole("user1"));
            Connection.SetStreamMetadata("metaread-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetMetadataReadRole("user1"));
            Connection.SetStreamMetadata("metawrite-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetMetadataWriteRole("user1"));

            Connection.SetStreamMetadata("$all", ExpectedVersion.Any, StreamMetadata.Build().SetReadRole("user1"), new UserCredentials("adm", "admpa$$"));

            Connection.SetStreamMetadata("$system-acl", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole("user1")
                                         .SetWriteRole("user1")
                                         .SetMetadataReadRole("user1")
                                         .SetMetadataWriteRole("user1"), new UserCredentials("adm", "admpa$$"));
            Connection.SetStreamMetadata("$system-adm", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.Admins)
                                         .SetWriteRole(SystemRoles.Admins)
                                         .SetMetadataReadRole(SystemRoles.Admins)
                                         .SetMetadataWriteRole(SystemRoles.Admins), new UserCredentials("adm", "admpa$$"));

            Connection.SetStreamMetadata("normal-all", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.All)
                                         .SetWriteRole(SystemRoles.All)
                                         .SetMetadataReadRole(SystemRoles.All)
                                         .SetMetadataWriteRole(SystemRoles.All));
            Connection.SetStreamMetadata("$system-all", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.All)
                                         .SetWriteRole(SystemRoles.All)
                                         .SetMetadataReadRole(SystemRoles.All)
                                         .SetMetadataWriteRole(SystemRoles.All), new UserCredentials("adm", "admpa$$"));
        }
コード例 #36
0
 public GetEventStoreAdapter(IEventStoreConnection eventStoreConnection, IEventPublisher eventsPublisher, IConstructAggregates constructAggregates)
     : this(eventStoreConnection, eventsPublisher, (t, g) => string.Format("{0}-{1}", char.ToLower(t.Name[0]) + t.Name.Substring(1), g.ToString("N")), constructAggregates)
 {
 }
 public FunctionalStore(IEventStoreConnection connection)
 => _connection = connection;
コード例 #38
0
        protected virtual EventStoreRepository GetSut(string prefix, IEventStoreConnection connection)
        {
            EventStoreContext context = EventStoreContext.CreateDefault(prefix, connection);

            return(new EventStoreRepository(context, new EventSourceConfiguration()));
        }
コード例 #39
0
        private static async Task <IEnumerable <ResolvedEvent> > GetAllResolvedEvents(IEventStoreConnection conn, string streamId)
        {
            var streamEvents = new List <ResolvedEvent>();

            StreamEventsSlice currentSlice;
            long nextSliceStart = StreamPosition.Start;

            do
            {
                currentSlice = await conn.ReadStreamEventsForwardAsync(streamId, nextSliceStart,
                                                                       ClientApiConstants.MaxReadSize, false);

                nextSliceStart = currentSlice.NextEventNumber;
                streamEvents.AddRange(currentSlice.Events);
            } while (!currentSlice.IsEndOfStream);

            return(streamEvents);
        }
コード例 #40
0
 public StreamWriter(IEventStoreConnection store, string stream, long version)
 {
     _store   = store;
     _stream  = stream;
     _version = version;
 }
コード例 #41
0
 public static IEventStoreConnection CreateConnection()
 {
     return(_connection = _connection ?? Connect());
 }
コード例 #42
0
 public ApiCompositionRoot(IEventStoreConnection connection)
 {
     _connection = connection;
 }
コード例 #43
0
 public AggregateStore(IEventStoreConnection connection)
 => _connection = connection;
コード例 #44
0
 public GesAggregateStore(IEventStoreConnection eventStoreConnection,
                          UserCredentials userCredentials = null)
 {
     this.eventStoreConnection = eventStoreConnection ?? throw new ArgumentNullException(nameof(eventStoreConnection));;
     this.userCredentials      = userCredentials;
 }
コード例 #45
0
 private EventStoreRepository(EventStoreRepositoryConfiguration configuration, IEventStoreConnection eventStoreConnection, IConnectionStatusMonitor connectionMonitor)
 {
     _eventStoreRepositoryConfiguration = configuration;
     _eventStoreConnection = eventStoreConnection;
     _connectionMonitor    = connectionMonitor;
 }
コード例 #46
0
 /// <summary>
 /// Read events until the given position or event number async.
 /// </summary>
 /// <param name="connection">The connection.</param>
 /// <param name="resolveLinkTos">Whether to resolve Link events.</param>
 /// <param name="userCredentials">User credentials for the operation.</param>
 /// <param name="lastCommitPosition">The commit position to read until.</param>
 /// <param name="lastEventNumber">The event number to read until.</param>
 /// <returns></returns>
 protected abstract Task ReadEventsTillAsync(IEventStoreConnection connection,
                                             bool resolveLinkTos,
                                             UserCredentials userCredentials,
                                             long?lastCommitPosition,
                                             int?lastEventNumber);
コード例 #47
0
 public ProjectionManagerBuilder Connection(IEventStoreConnection connection)
 {
     _connection = connection;
     return(this);
 }
コード例 #48
0
 public EsAggregateStore(IEventStoreConnection connection)
 {
     _connection = connection;
 }
コード例 #49
0
 public EventStoreEventStore(IEventStoreConnection connection)
 {
     this.connection = connection;
 }
コード例 #50
0
        public override void TestFixtureSetUp()
        {
#if !__MonoCS__
            Helper.EatException(() => _dumpResponse  = CreateDumpResponse());
            Helper.EatException(() => _dumpResponse2 = CreateDumpResponse2());
            Helper.EatException(() => _dumpRequest   = CreateDumpRequest());
            Helper.EatException(() => _dumpRequest2  = CreateDumpRequest2());
#endif

            base.TestFixtureSetUp();

            bool createdMiniNode = false;
            if (SetUpFixture._connection != null && SetUpFixture._node != null)
            {
                _tag        = "_" + (++SetUpFixture._counter);
                _node       = SetUpFixture._node;
                _connection = SetUpFixture._connection;
            }
            else
            {
                createdMiniNode = true;
                _tag            = "_1";
                _node           = CreateMiniNode();
                _node.Start();

                _connection = TestConnection.Create(_node.TcpEndPoint);
                _connection.ConnectAsync().Wait();
            }
            _lastResponse      = null;
            _lastResponseBody  = null;
            _lastJsonException = null;
            try
            {
                Given();
                When();
            }
            catch
            {
                if (createdMiniNode)
                {
                    if (_connection != null)
                    {
                        try
                        {
                            _connection.Close();
                        }
                        catch
                        {
                        }
                    }
                    if (_node != null)
                    {
                        try
                        {
                            _node.Shutdown();
                        }
                        catch
                        {
                        }
                    }
                }
                throw;
            }
        }
コード例 #51
0
 public ReadModelConsumer(IEventStoreConnection connection, IEventDispatcher dispatcher, IEventStoreRepository eventStoreRepository)
     : base(connection, dispatcher, eventStoreRepository)
 {
 }
コード例 #52
0
 public EventStoreDomainRepository(string category, IEventStoreConnection connection)
 {
     Category    = category;
     _connection = connection;
 }
コード例 #53
0
ファイル: EventStoreEventStore.cs プロジェクト: vip32/Naos
        public EventStoreEventStore(IEventStoreConnection connection)
        {
            EnsureArg.IsNotNull(connection, nameof(connection));

            this.connection = connection;
        }
コード例 #54
0
 public EventStoreService(IEventStoreConnection esConnection, ProjectionManager projectionManager)
 {
     _esConnection      = esConnection;
     _projectionManager = projectionManager;
 }
コード例 #55
0
 public EventStoreHostedService(IEventStoreConnection connection, AllStreamSubscription subscription)
 {
     _connection   = connection;
     _subscription = subscription;
 }
コード例 #56
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EventStoreOutboxSync" /> class.
 /// </summary>
 /// <param name="eventStore">The active subscription to an Event Store instance.</param>
 public EventStoreOutboxSync(IEventStoreConnection eventStore)
 {
     _eventStore = eventStore;
 }
 private static StreamEventsSlice ReadStreamEventsBackwards(this IEventStoreConnection connection, string streamName, long lastEventNumber)
 {
     return(connection.ReadStreamEventsBackwardAsync(streamName, lastEventNumber, PageSize, false).Result);
 }
コード例 #58
0
 public CounterRepository(IEventStoreConnection conn)
 {
     _conn = conn;
 }
コード例 #59
0
        private static async Task <IEnumerable <string> > GetAllRawEvents(IEventStoreConnection conn, string streamId)
        {
            var streamEvents = await GetAllResolvedEvents(conn, streamId);

            return(streamEvents.Select(e => Encoding.UTF8.GetString(e.Event.Data)));
        }
コード例 #60
0
 public TransactionalWriter(IEventStoreConnection store, string stream)
 {
     _store  = store;
     _stream = stream;
 }