Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gdvalishvili1/EventStore-Subscriber

Open more actions menu

Repository files navigation

EventStore-Subscriber

EventStore (GES) Subscriber With EventDispatcher and Handlers

Example

public class ExampleAggregateCreatedEvent : IStoredEvent
    {
        public ExampleAggregateCreatedEvent(string state)
        {
            State = state;
        }

        public string State { get; }
    }

 //start listening on every stream change, and dispatch deserialized event to every registered eventHandlers like below 
 new CatchUpSubscriptionClient(
                    serviceProvider,
                    eventPositionRepository,
                    unitOfWork,
                    storedEventSerializer,
                    eventDispatcher
                    ).Start(eventStoreConnString,
                    config.GetValue<string>("EventStore:UserName"),
                    config.GetValue<string>("EventStore:Password"));

 //subscribed event stream changes handled here
 public class ExampleEventStoreEventHandler : IHandleStoredEvent<ExampleAggregateCreatedEvent>
    {
        public void Handle(FakeAggregateCreatedEvent @event, StoredEventDispatchContext storedEventDispatchContext)
        {
            //do work like storedEventDispatchContext.ServiceProvider.GetService<SomeRepository>().Save();
        }
    } 

About

EventStore (GES) Subscriber With EventDispatcher and Handlers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.