Exemple #1
0
 public EventTransaction(RayGrain <TState, TStateKey> rayGrain, IServiceProvider serviceProvider, IEventSourcing <TState, TStateKey> eventSourcing)
 {
     this.rayGrain      = rayGrain;
     this.serializer    = serviceProvider.GetRequiredServiceByName <ISerializer>(SerializationType.JsonUTF8);
     this.eventSourcing = eventSourcing;
     this.State         = this.Clone(rayGrain.State);
 }
Exemple #2
0
 public async Task Subscribe(IEventSourcing aggregate)
 {
     foreach (var evt in aggregate.GetUncommittedEvents())
     {
         await _handler.Handle((Event)evt, aggregate.Version);
     }
 }
Exemple #3
0
 public EventTransaction(RayGrain <TState, TStateKey> rayGrain)
 {
     this.rayGrain      = rayGrain;
     this.eventSourcing = rayGrain.eventSourcing;
     this.mqPublisher   = rayGrain.MQPublisher;
     this.State         = this.Clone(rayGrain.State);
 }
Exemple #4
0
        public PaymentProjection(IEventSourcing eventSourcing)
        {
            _eventSourcing = eventSourcing;
            _events        = new Dictionary <Guid, PaymentModel>();

            _map = CreatePaymentEventMap()
                   .BuildBalanceMap();
        }
Exemple #5
0
 public void BootstrapEventSourcing(
     IEventSourcing eventSourcing,
     IRepositories repositories,
     Action <object> eventPublisher)
 {
     eventSourcing.RegisterEventReplayer <JourneyCreatedEvent>(new JourneyCreatedEventReplayer(repositories, eventPublisher).Replay);
     eventSourcing.RegisterEventReplayer <LiftAddedEvent>(new LiftAddedEventReplayer(repositories).Replay);
     eventSourcing.RegisterEventReplayer <PersonCreatedEvent>(new PersonCreatedEventReplayer(repositories, eventPublisher).Replay);
 }
Exemple #6
0
 public void SetUp()
 {
     eventSourcingService = new EventSourcing();
     cqrsWrite            = Substitute.For <ICQRSWrite>();
     cqrsRead             = Substitute.For <ICQRSRead>();
     eventSourcing        = new EventSourcing(cqrsRead, cqrsWrite);
     lista = new List <string>()
     {
         "Repozitorijumi.txt"
     };
 }
Exemple #7
0
        public void GetUncommittedEventsOfNewAggregateShouldReturnListOfIDomainEvent()
        {
            //Arrange

            IEventSourcing aggregate = CreateNewAggregate <StubEventSourcing>();

            //Act
            var result = aggregate.GetUncommittedEvents();

            //Assert
            Assert.NotNull(result);
            Assert.Empty(result);
            Assert.IsAssignableFrom <IEnumerable <IDomainEvent> >(result);
        }
Exemple #8
0
        /// <summary>
        /// Activate Grain
        /// </summary>
        /// <returns></returns>
        public override async Task OnActivateAsync()
        {
            try
            {
                this.eventSourcing = await this.ServiceProvider.GetEventSourcing <TState, TStateKey>(this)
                                     .Init(this.StateId);

                this.MQPublisher = this.ServiceProvider.GetRequiredServiceByName <IMQPublisher>(this.GetType().FullName);
                this.State       = await this.eventSourcing.ReadSnapshotAsync();

                await base.OnActivateAsync();
            }
            catch (Exception ex)
            {
                this.Logger.LogError(ex, $"{StateId} Activate Grain failure");
                throw ex;
            }
        }
Exemple #9
0
        /// <summary>
        /// Activate Grain
        /// </summary>
        /// <returns></returns>
        public override async Task OnActivateAsync()
        {
            try
            {
                this._eventBufferBlock      = new DataflowBufferBlock <EventTransactionModel <TStateKey> >(this.TriggerEventStorage);
                this._internalConfiguration = this.ServiceProvider.GetRequiredService <IInternalConfiguration>();
                this._mqPublisher           = this.ServiceProvider.GetRequiredService <IMQPublisher>();
                this._eventSourcing         = await this.ServiceProvider.GetEventSourcing <TState, TStateKey>(this).Init(this.StateId);

                this.State = await this._eventSourcing.ReadSnapshotAsync();

                this.PublishOptions = this._internalConfiguration.GetEventPublishOptions(this);
                await base.OnActivateAsync();
            }
            catch (Exception ex)
            {
                this.Logger.LogError(ex, $"{StateId} Activate Grain failure");
                throw ex;
            }
        }
Exemple #10
0
 public Ambassador(IEventSourcing es)
 {
     m_IEventSourcing = es;
 }
Exemple #11
0
 public EventSourcing(IEventSourcing eventSourcing)
 {
     _eventSourcing = eventSourcing;
 }