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); }
public async Task Subscribe(IEventSourcing aggregate) { foreach (var evt in aggregate.GetUncommittedEvents()) { await _handler.Handle((Event)evt, aggregate.Version); } }
public EventTransaction(RayGrain <TState, TStateKey> rayGrain) { this.rayGrain = rayGrain; this.eventSourcing = rayGrain.eventSourcing; this.mqPublisher = rayGrain.MQPublisher; this.State = this.Clone(rayGrain.State); }
public PaymentProjection(IEventSourcing eventSourcing) { _eventSourcing = eventSourcing; _events = new Dictionary <Guid, PaymentModel>(); _map = CreatePaymentEventMap() .BuildBalanceMap(); }
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); }
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" }; }
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); }
/// <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; } }
/// <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; } }
public Ambassador(IEventSourcing es) { m_IEventSourcing = es; }
public EventSourcing(IEventSourcing eventSourcing) { _eventSourcing = eventSourcing; }