Exemple #1
0
        public override async Task OnActivateAsync()
        {
            await base.OnActivateAsync();

            eventTableStoreStream = await eventTableStore.ProvisonEventStream(Id);

            ActorId.TryAdd("ProjectionActorId", Self.Path.Id);
            state = Activator.CreateInstance <T>();

            var savedData = await fileStorageProvider.ReadFromFile <T>(Id);

            if (savedData != null)
            {
                state   = savedData.State;
                version = savedData.Version;
            }

            var streamProvider = GetStreamProvider("SMSProvider");
            var stream         = streamProvider.GetStream <IEventEnvelope>(Guid.Empty, Id);
            await stream.SubscribeAsync(HandleRecivedEvent);
        }