Ejemplo n.º 1
0
        public void Dispose()
        {
            var copyTransactions = new Dictionary <string, long>(_runningTransactions);

            foreach (var trans in copyTransactions)
            {
                try
                {
                    if (_eventStoreClient != null)
                    {
                        var storeTransaction = _eventStoreClient.ContinueTransaction(trans.Value);
                        storeTransaction.Rollback();
                        storeTransaction.Dispose();
                    }
                }
                catch (Exception esException)
                {
                    _logger.LogError(esException, esException.Message);
                    throw;
                }
                finally
                {
                    _runningTransactions.Remove(trans.Key);
                    _eventStoreClient = null;
                }
            }
        }
Ejemplo n.º 2
0
 public DevicesStatusCheckEventHandler(IApplicationDbContext dbContext, IDateTimeProvider dateTimeProvider,
                                       IEventStoreClient eventStore)
 {
     _dbContext        = dbContext;
     _dateTimeProvider = dateTimeProvider;
     _eventStore       = eventStore;
 }
        public AccountContactsFactory(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory, IEnumerable<IAccountContactProvider> accountContactProviders)
        {
            _eventStoreClient = eventStoreClient;
            _loggerFactory = loggerFactory;

            _accountContactProviders = accountContactProviders.ToReadOnlyDictionary(acp => acp.Provider);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
 /// </summary>
 /// <param name="eventStoreClient">An event store client.</param>
 /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
 /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
 /// <param name="handlerResolver">A collection of handler modules to dispatch the commit to.</param>
 /// <exception cref="System.ArgumentNullException">
 /// eventStoreClient
 /// or
 /// checkpointRepository
 /// or
 /// dispatchCommit
 /// </exception>
 public DurableCommitDispatcher(
     [NotNull] IEventStoreClient eventStoreClient,
     [NotNull] ICheckpointRepository checkpointRepository,
     [NotNull] IHandlerResolver handlerResolver)
     : this(eventStoreClient, checkpointRepository, handlerResolver.DispatchCommit)
 {
 }
Ejemplo n.º 5
0
 public PathStreamEventsReader(
     ILogger <PathStreamEventsReader> logger,
     IEventStoreClient eventStoreClient)
 {
     this._logger     = logger;
     this._client     = eventStoreClient;
     this._pathStream = new PathStream();
 }
 public CloseWindowsExecutor(IDateTimeProvider dateTimeProvider, IEventStoreClient eventStoreClient,
                             IApplicationDbContext dbContext, IMediator mediator)
 {
     _dateTimeProvider = dateTimeProvider;
     _eventStoreClient = eventStoreClient;
     _dbContext        = dbContext;
     _mediator         = mediator;
 }
Ejemplo n.º 7
0
 public FeatureStreamEventsReader(
     ILogger <FeatureStreamEventsReader> logger,
     IEventStoreClient eventStoreClient)
 {
     this._logger        = logger;
     this._client        = eventStoreClient;
     this._featureStream = new FeatureStream();
 }
Ejemplo n.º 8
0
 public static void SaveEvent <T>(this IEventStoreClient eventStoreClient, string streamName, int expectedVersion, Guid eventId, T data)
 {
     eventStoreClient.SaveEvent(streamName,
                                expectedVersion,
                                eventId,
                                data.GetType().Name,
                                JsonConvert.SerializeObject(data));
 }
Ejemplo n.º 9
0
 public EventRepository(
     IEventStoreClient store,
     IDictionary <string, Func <string, Event> > eventDeserializers = null
     )
 {
     _store = store;
     _eventDeserializers = eventDeserializers ?? new Dictionary <string, Func <string, Event> >();
 }
 internal static FeatureStreamEventsReader GivenFeatureStreamEventsReader(
     this FeatureStreamEventsReaderTests tests,
     IEventStoreClient client)
 {
     return(new FeatureStreamEventsReader(
                tests.GivenLogger <FeatureStreamEventsReader>(),
                client));
 }
Ejemplo n.º 11
0
 protected DomainEventBase(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory, string streamName)
 {
     _streamName = streamName;
     _eventStoreClient = eventStoreClient;
     _logger = loggerFactory.CreateLogger(GetType());
     
     ReadVersion = ExpectedVersion.NoStream;
 }
Ejemplo n.º 12
0
 internal static PathStreamEventsReader GivenPathStreamEventsReader(
     this PathStreamEventsReaderTests tests,
     IEventStoreClient client)
 {
     return(new PathStreamEventsReader(
                tests.GivenLogger <PathStreamEventsReader>(),
                client));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
 /// </summary>
 /// <param name="eventStoreClient">An event store client.</param>
 /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
 /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
 /// <param name="handlerModules">A collection of handler modules to dispatch the commit to.</param>
 /// <param name="retryPolicy">A retry policy when a <see cref="TransientException"/> occurs.
 /// If none specified TransientException.None is used.</param>
 /// <exception cref="System.ArgumentNullException">
 /// eventStoreClient
 /// or
 /// checkpointRepository
 /// or
 /// dispatchCommit
 /// </exception>
 public DurableCommitDispatcher(
     [NotNull] IEventStoreClient eventStoreClient,
     [NotNull] ICheckpointRepository checkpointRepository,
     [NotNull] IEnumerable <IHandlerResolver> handlerModules,
     TransientExceptionRetryPolicy retryPolicy = null) :
     this(eventStoreClient, checkpointRepository, handlerModules.DispatchCommit, retryPolicy)
 {
     Guard.EnsureNotNull(handlerModules, "handlerModule");
 }
Ejemplo n.º 14
0
 public StateProjector(
     IEventStoreClient eventStore,
     IStreamReadValidator readValidator,
     ICommandHandlerMetadata <TCommand> handlerMetadata)
 {
     this.eventStore      = eventStore;
     this.readValidator   = readValidator;
     this.handlerMetadata = handlerMetadata;
 }
 public NewUserScenario(IEventStoreClient eventStoreClient)
 {
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), Substitute.For<IAccountFactory>(), Substitute.For<IAccountContactRefresher>());
     _userRepository.Run().Wait();
     
     _account = new StubAccount();
     _account.CurrentSession.AuthorizedResources.Add("email");
     _account.CurrentSession.AuthorizedResources.Add("calendar");
 }
Ejemplo n.º 16
0
 public EventRepository(
     IEventStoreClient store,
     IOptionsMonitor <EventStoreConfig> eventStoreOptions,
     IDictionary <string, Func <string, object, long, long, EventModel <TId> > > eventDeserializers = null
     )
 {
     _store              = store;
     _sourceApp          = eventStoreOptions.CurrentValue.ApplicationName;
     _eventDeserializers = eventDeserializers ?? new Dictionary <string, Func <string, object, long, long, EventModel <TId> > >();
 }
Ejemplo n.º 17
0
 public static IPathsAggregate GivenAggregate(
     this PathsAggregateTests tests,
     IReadStreamedEvents <PathStream> reader,
     IEventStoreClient client)
 {
     return(new PathsAggregate(
                tests.GivenLogger <PathsAggregate>(),
                reader,
                client));
 }
Ejemplo n.º 18
0
 public static IFeaturesAggregate GivenAggregate(
     this FeaturesAggregateTests tests,
     IReadStreamedEvents <FeatureStream> reader,
     IEventStoreClient client)
 {
     return(new FeaturesAggregate(
                tests.GivenLogger <FeaturesAggregate>(),
                reader,
                client));
 }
 public CreatePaymentCommandHandler(IAcquiringBankService acquiringBankService,
                                    IPaymentHistoryRepository paymentHistoryRepository, IMetrics metrics,
                                    ILogger <CreatePaymentCommandHandler> logger, IEventStoreClient eventStoreClient)
 {
     _acquiringBankService     = acquiringBankService;
     _paymentHistoryRepository = paymentHistoryRepository;
     _metrics          = metrics;
     _logger           = logger;
     _eventStoreClient = eventStoreClient;
 }
Ejemplo n.º 20
0
 public PathsAggregate(
     ILogger <PathsAggregate> logger,
     IReadStreamedEvents <PathStream> reader,
     IEventStoreClient client
     )
 {
     this._logger     = logger;
     this._reader     = reader;
     this._client     = client;
     this._pathStream = new PathStream();
     this.Paths       = Enumerable.Empty <IPath>();
 }
Ejemplo n.º 21
0
 public FeaturesAggregate(
     ILogger <FeaturesAggregate> logger,
     IReadStreamedEvents <FeatureStream> reader,
     IEventStoreClient client
     )
 {
     this._logger        = logger;
     this._reader        = reader;
     this._client        = client;
     this._featureStream = new FeatureStream();
     this.Features       = Enumerable.Empty <IFeature>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
        /// </summary>
        /// <param name="eventStoreClient">An event store client.</param>
        /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
        /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
        /// <param name="dispatchCommit">A handler to dispatch the commit to.</param>
        /// <param name="retryPolicy">A retry policy when a <see cref="TransientException"/> occurs.
        /// If none specified TransientException.None is used.</param>
        /// <exception cref="System.ArgumentNullException">
        /// eventStoreClient
        /// or
        /// checkpointRepository
        /// or
        /// dispatchCommit
        /// </exception>
        public DurableCommitDispatcher(
            [NotNull] IEventStoreClient eventStoreClient,
            [NotNull] ICheckpointRepository checkpointRepository,
            [NotNull] Func<ICommit, CancellationToken, Task> dispatchCommit)
        {
            Ensure.That(eventStoreClient, "eventStoreClient").IsNotNull();
            Ensure.That(checkpointRepository, "checkpointRepository").IsNotNull();
            Ensure.That(dispatchCommit, "dispatchCommit").IsNotNull();

            _eventStoreClient = eventStoreClient;
            _checkpointRepository = checkpointRepository;
            _dispatchCommit = dispatchCommit;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
        /// </summary>
        /// <param name="eventStoreClient">An event store client.</param>
        /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
        /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
        /// <param name="dispatchCommit">A handler to dispatch the commit to.</param>
        /// <param name="retryPolicy">A retry policy when a <see cref="TransientException"/> occurs.
        /// If none specified TransientException.None is used.</param>
        /// <exception cref="System.ArgumentNullException">
        /// eventStoreClient
        /// or
        /// checkpointRepository
        /// or
        /// dispatchCommit
        /// </exception>
        public DurableCommitDispatcher(
            [NotNull] IEventStoreClient eventStoreClient,
            [NotNull] ICheckpointRepository checkpointRepository,
            [NotNull] Func <ICommit, CancellationToken, Task> dispatchCommit)
        {
            Ensure.That(eventStoreClient, "eventStoreClient").IsNotNull();
            Ensure.That(checkpointRepository, "checkpointRepository").IsNotNull();
            Ensure.That(dispatchCommit, "dispatchCommit").IsNotNull();

            _eventStoreClient     = eventStoreClient;
            _checkpointRepository = checkpointRepository;
            _dispatchCommit       = dispatchCommit;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
        /// </summary>
        /// <param name="eventStoreClient">An event store client.</param>
        /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
        /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
        /// <param name="dispatchCommit">A handler to dispatch the commit to.</param>
        /// <param name="retryPolicy">A retry policy when a <see cref="TransientException"/> occurs.
        /// If none specified TransientException.None is used.</param>
        /// <exception cref="System.ArgumentNullException">
        /// eventStoreClient
        /// or
        /// checkpointRepository
        /// or
        /// dispatchCommit
        /// </exception>
        public DurableCommitDispatcher(
            [NotNull] IEventStoreClient eventStoreClient,
            [NotNull] ICheckpointRepository checkpointRepository,
            [NotNull] Func <ICommit, CancellationToken, Task> dispatchCommit,
            TransientExceptionRetryPolicy retryPolicy = null)
        {
            Guard.EnsureNotNull(eventStoreClient, "eventStoreClient");
            Guard.EnsureNotNull(checkpointRepository, "checkpointRepository");
            Guard.EnsureNotNull(dispatchCommit, "dispatchCommit");

            _eventStoreClient     = eventStoreClient;
            _checkpointRepository = checkpointRepository;
            _dispatchCommit       = dispatchCommit;
            _retryPolicy          = retryPolicy ?? TransientExceptionRetryPolicy.None();
        }
Ejemplo n.º 25
0
            public UserWithSingleAccountAddsAccount(IEventStoreClient eventStoreClient)
            {
                var accountFactory = new AccountFactory();
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, Substitute.For<IAccountContactRefresher>());

                _initialAccount = new StubAccount();
                _allAccounts.Add(_initialAccount);

                _newAccount = new StubAccount
                {
                    AccountId = "OtherAccount",
                    DisplayName = "Other Account"
                };
                _allAccounts.Add(_newAccount);
            }
Ejemplo n.º 26
0
        public ProjectionJob(
            IEventStoreClient client,
            IDependencyInitializer initializer,
            IProjectionOptionsFactory optionsFactory,
            IProjectionProcessor <TProjection> processor)
        {
            this.jobDependencies = initializer;
            this.processor       = processor;

            var options = optionsFactory.GetOptions <TProjection>();

            subscription = client.SubscribeToStreams(
                ConsumerGroup.GetAsAutoScalingInstance(options.Name),
                SubscriptionStartOptions.FromBegining,
                OnProcessEventsAsync);
        }
Ejemplo n.º 27
0
        public AccountContacts(
            IEventStoreClient eventStoreClient,
            ILoggerFactory loggerFactory,
            IAccountContactProvider contactProvider,
            IAccount account)
        {
            if (contactProvider == null) throw new ArgumentNullException("contactProvider");
            if (account == null) throw new ArgumentNullException("provider");
            if (contactProvider.Provider != account.Provider) throw new InvalidOperationException("Provider must match the provider for the accountContactProvider");

            _eventStoreClient = eventStoreClient;
            _contactProvider = contactProvider;
            _accountId = account.AccountId;
            _provider = account.Provider;
            _logger = loggerFactory.CreateLogger(GetType());
            CurrentSession = account.CurrentSession;

            _logger.Debug("AccountContacts created for {0}", account.AccountId);
        }
Ejemplo n.º 28
0
 private async Task Connect()
 {
     if (string.IsNullOrWhiteSpace(_config?.ConnectionStringSetting))
     {
         var esException = new EventStoreStreamsBindingException("ConnectionString cant be empty");
         _logger.LogError(esException, esException.Message);
         throw esException;
     }
     try
     {
         _eventStoreClient = new EventStoreClient(_config.ConnectionStringSetting, _logger);
         await _eventStoreClient.Connect().ConfigureAwait(false);
     }
     catch (Exception esException)
     {
         _logger.LogError(esException, esException.Message);
         throw esException;
     }
 }
Ejemplo n.º 29
0
 public SaveEvent(IEventGridMessageDeserializer eventGridMessageDeserializer, IEventStoreClient eventStoreClient)
 {
     _eventGridMessageDeserializer = eventGridMessageDeserializer;
     _eventStoreClient             = eventStoreClient;
 }
 public AccountContactSynchronizationService(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory, IAccountContactsFactory accountContactsFactory)
     : base(eventStoreClient, loggerFactory, ContactStreamNames.AccountRefreshRequests())
 {
     _accountContactsFactory = accountContactsFactory;
 }
 public FetchUserContactProfileScenario(IEventStoreClient eventStoreClient)
 {
     _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
     var accountFactory = new AccountFactory();
     var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
     _account = CreateAccount();
     _expectedFeed = CreateStubFeed(_account);
     _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, _account, _expectedFeed);
     _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
 }
 public AccountContactRefresher(IEventStoreClient eventStoreClient)
 {
     _eventStoreClient = eventStoreClient;
 }
            public UserWithSingleAccountLogsInScenario(IEventStoreClient eventStoreClient)
            {
                var accountFactory = new AccountFactory();
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, Substitute.For<IAccountContactRefresher>());

                _account = new StubAccount();
                _allAccounts.Add(_account);
            }
Ejemplo n.º 34
0
 public UserRepository(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory, IAccountFactory accountFactory, IAccountContactRefresher accountContactRefresher)
     : base(eventStoreClient, loggerFactory, "Users")
 {
     _accountFactory = accountFactory;
     _accountContactRefresher = accountContactRefresher;
 }
Ejemplo n.º 35
0
 public DealRepository(IEventStoreClient eventStoreClient, IMessageBusClient messageBusClient)
 {
     _eventStoreClient = eventStoreClient;
     _messageBusClient = messageBusClient;
 }
            public UserAddsAccountAndContactsSynchronizeScenario(IEventStoreClient eventStoreClient)
            {
                _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
                var accountFactory = new AccountFactory();
                var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
                _initialAccount = CreateAccount("main");
                _initialAccountContactFeed = new[] { Alex(_initialAccount), Billy(_initialAccount), Charlie(_initialAccount) }.ToObservable();

                _newAccount = CreateAccount("other", "OtherProvider");
                _newAccountContactFeed = new[] { Alex(_newAccount), Derek(_newAccount) }.ToObservable();

                var accContactProviders = new[]
                {
                    CreateAccountContactProvider(_initialAccount, _initialAccountContactFeed),
                    CreateAccountContactProvider(_newAccount, _newAccountContactFeed),
                };

                _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, accContactProviders);
                _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
            }
 public UserContactSynchronizationService(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory)
     : base(eventStoreClient, loggerFactory)
 {
     Logger.Info("UserContactSynchronizationService ctor");
 }
 private static AccountContactSynchronizationService CreateAccountContactSynchronizationService(
     IEventStoreClient eventStoreClient, IAccount account, IObservable<IAccountContactSummary> expectedFeed)
 {
     var dummyAccountContactProvider = CreateAccountContactProvider(account, expectedFeed);
     var accountContactsFactory = new AccountContactsFactory(eventStoreClient,
         new ConsoleLoggerFactory(),
         new[] { dummyAccountContactProvider });
     var accountContactSynchronizationService = new AccountContactSynchronizationService(eventStoreClient,
         new ConsoleLoggerFactory(),
         accountContactsFactory);
     return accountContactSynchronizationService;
 }
 public GetWindowsStatusQueryHandler(IEventStoreClient eventStoreClient, IDateTimeProvider dateTimeProvider)
 {
     _eventStoreClient = eventStoreClient;
     _dateTimeProvider = dateTimeProvider;
 }
 private static AccountContactSynchronizationService CreateAccountContactSynchronizationService(
     IEventStoreClient eventStoreClient, IEnumerable<IAccountContactProvider> accountContactProviders)
 {
     var accountContactsFactory = new AccountContactsFactory(eventStoreClient,
         new ConsoleLoggerFactory(),
         accountContactProviders);
     var accountContactSynchronizationService = new AccountContactSynchronizationService(eventStoreClient,
         new ConsoleLoggerFactory(),
         accountContactsFactory);
     return accountContactSynchronizationService;
 }
Ejemplo n.º 41
0
 public StateWriter(
     IEventStoreClient eventStore)
 {
     this.eventStore = eventStore;
 }
Ejemplo n.º 42
0
 public DealCaptureController(IEventStoreClient eventStoreClient)
 {
     _eventStoreClient = eventStoreClient;
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitDispatcher"/> class.
        /// </summary>
        /// <param name="eventStoreClient">An event store client.</param>
        /// <param name="checkpointRepository">A checkpoint repository. Each instane of a <see cref="DurableCommitDispatcher"/>
        /// should have their own instance of a <see cref="ICheckpointRepository"/>.</param>
        /// <param name="dispatchCommit">A handler to dispatch the commit to.</param>
        /// <param name="retryPolicy">A retry policy when a <see cref="TransientException"/> occurs.
        /// If none specified TransientException.None is used.</param>
        /// <exception cref="System.ArgumentNullException">
        /// eventStoreClient
        /// or
        /// checkpointRepository
        /// or
        /// dispatchCommit
        /// </exception>
        public DurableCommitDispatcher(
            [NotNull] IEventStoreClient eventStoreClient,
            [NotNull] ICheckpointRepository checkpointRepository,
            [NotNull] Func<ICommit, CancellationToken, Task> dispatchCommit,
            TransientExceptionRetryPolicy retryPolicy = null)
        {
            Guard.EnsureNotNull(eventStoreClient, "eventStoreClient");
            Guard.EnsureNotNull(checkpointRepository, "checkpointRepository");
            Guard.EnsureNotNull(dispatchCommit, "dispatchCommit");

            _eventStoreClient = eventStoreClient;
            _checkpointRepository = checkpointRepository;
            _dispatchCommit = dispatchCommit;
            _retryPolicy = retryPolicy ?? TransientExceptionRetryPolicy.None();
            _compositeDisposable.Add(_commitsProjectedStream);
        }
 public UserRegistrationAccountContactSynchronizationScenario(IEventStoreClient eventStoreClient)
 {
     _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
     var accountFactory = new AccountFactory();
     var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
     _account = CreateAccount("*****@*****.**");
     _expectedFeed = new[] { Alex(_account), Billy(_account), Charlie(_account) }.ToObservable();
     var accContactProviders = new[] { CreateAccountContactProvider(_account, _expectedFeed) };
     _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, accContactProviders);
     _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
 }
Ejemplo n.º 45
0
 protected AllEventListenerBase(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory)
 {
     _eventStoreClient = eventStoreClient;
     _logger = loggerFactory.CreateLogger(GetType());
     _eventLoopScheduler = new EventLoopScheduler(ts => new Thread(ts) { Name = string.Format("{0}.AllEventListener", GetType().Name) });
 }
Ejemplo n.º 46
0
 public AddRoomCommandHandler(IAggregateFactory <Room> roomFactory, IEventStoreClient eventStoreClient)
 {
     _roomFactory      = roomFactory;
     _eventStoreClient = eventStoreClient;
 }
Ejemplo n.º 47
0
 public static IObservable <T> GetEvents <T>(this IEventStoreClient eventStoreClient, string streamName)
 {
     return(eventStoreClient.GetEvents(streamName)
            .Select(re => Encoding.UTF8.GetString(re.OriginalEvent.Data))
            .Select(JsonConvert.DeserializeObject <T>));
 }
 public EventStoreContactFeedRepository(IEventStoreClient eventStoreClient, ILoggerFactory loggerFactory)
 {
     _eventStoreClient = eventStoreClient;
     _logger = loggerFactory.CreateLogger(GetType());
 }
 public CancelReservationCommandHandler(IAggregateFactory <Reservation> reservationFactory, IEventStoreClient eventStoreClient)
 {
     _reservationFactory = reservationFactory;
     _eventStoreClient   = eventStoreClient;
 }
 public AggregateFactory(IEventStoreClient eventStoreClient)
 {
     _eventStoreClient = eventStoreClient;
 }
Ejemplo n.º 51
0
        private void RegisterCommandHandlers(IFunctionsHostBuilder hostBuilder, IBus bus, IEventStoreClient eventStoreClient)
        {
            var serviceProvider = hostBuilder.Services.BuildServiceProvider();
            //aggregate factories
            var reservationFactory = serviceProvider.GetRequiredService <IAggregateFactory <Reservation> >();

            //command handler registrations
            bus.RegisterCommandHandler <MakeReservation>(new MakeReservationCommandHandler(reservationFactory, eventStoreClient).Handle); //virtual workshop ex-9
        }
Ejemplo n.º 52
0
 public DealEntryCommandHandler(IMessageBusClient messageBusClient, IEventStoreClient eventStoreClient)
 {
     _messageBusClient = messageBusClient;
     _eventStoreClient = eventStoreClient;
 }