EventFlow icon indicating copy to clipboard operation
EventFlow copied to clipboard

Upgrading to EventStore 20.6.1

Open frenchyjef opened this issue 5 years ago • 5 comments

Adding UseEventStoreSubscriptions extension to help subscribe to stream events based on a filter and then publish them to your internal microservices (pubsub)

Note that three (3) integration tests are failing due to EventStoreEventPersistence.LoadAllCommittedEvents fetching ALL events including "system events" which are prefixed with $ and fail when being deserialized.

I would like to have folks who use EventStoreDB to review this pull request and share their thoughts/feedback for improvements.

frenchyjef avatar Oct 05 '20 00:10 frenchyjef

@rasmus @frankebersoll @promontis @Brandon2255p Would this pull request related to EventStore be helpful to you all? Any feedback?

I essentially upgraded the libraries to use v20.6.1 as well as added a listener for SubscriptionToAll event stream.

frenchyjef avatar Oct 14 '20 16:10 frenchyjef

@frenchyjef it would be great to have the dependencies updated. Are there any issues with backward compatibility?

rasmus avatar Oct 17 '20 08:10 rasmus

@frenchyjef I really like the idea you brought of the eventstore subscription and the event filter. I implemented the same thing but mine stored the checkpoint in mongodb because that is our read store db and therefore that was the place that cares about the position. But storing it in event store is brilliant :)

Brandon2255p avatar Oct 17 '20 14:10 Brandon2255p

@rasmus Which dependencies are you referring to exactly? If you are referring to Nuget librairies, I just merged the develop branch into my pull request so the Nuget libraries should now be in sync with what is the develop branch.

@Brandon2255p Glad to hear that the implementation could be useful. I am using ElasticSearch for my read models, MongoDB for my snapshots and EventStore for events and checkpoints.

Here is the startup code:

            MongoClient mongoClient = new MongoClient(GetMongoClientSettings(
                eventingOptions.EventSnapshots.Host,
                eventingOptions.EventSnapshots.Port,
                eventingOptions.EventSnapshots.UseTls,
                eventingOptions.EventSnapshots.Username,
                eventingOptions.EventSnapshots.Password,
                eventingOptions.EventSnapshots.DatabaseName
            ));

            ConnectionSettings elasticSettings = new ConnectionSettings(new Uri(eventingOptions.EventReadModels.ConnectionString));
            if (!string.IsNullOrEmpty(eventingOptions.EventReadModels.Username) && !string.IsNullOrEmpty(eventingOptions.EventReadModels.Password))
                elasticSettings.BasicAuthentication(eventingOptions.EventReadModels.Username, eventingOptions.EventReadModels.Password);

            services.AddEventFlow(options => options
                .AddAspNetCore()
                .AddDefaults(typeof(IMarker_EdGraph_Application_Api_EventFlow).Assembly)
                .ConfigureElasticsearch(elasticSettings)
                .ConfigureEventStore(eventingOptions.EventStore)
                .ConfigureMongoDb(mongoClient, "eventflow-snapshots")
                .UseMongoDbSnapshotStore()
                .UseElasticsearchReadModel<ApplicationReadModel>()
                .UseEventStoreSubscriptions(
                    "EdGraph.Services.Application.Api",
                    StreamFilter.RegularExpression("^application|^client"),
                    100)
            );

            return services;

And here is the EventStoreExtension class in each microservice

    public static class EventStoreExtension
    {
        public static IEventFlowOptions ConfigureEventStore(this IEventFlowOptions options, EventStoreOptions eventStoreOptions)
        {
            EventStoreClientSettings eventStoreClientSettings = new EventStoreClientSettings
            {
                ConnectionName = "EdGraph.Services.Application.Api",
                ConnectivitySettings =
                {
                    Address = new Uri(eventStoreOptions.Host)
                },
                DefaultCredentials = new UserCredentials(eventStoreOptions.Username, eventStoreOptions.Password),

                CreateHttpMessageHandler = () =>
                    new HttpClientHandler
                    {
                        ServerCertificateCustomValidationCallback =
                            (message, certificate2, x509Chain, sslPolicyErrors) => true
                    }
            };

            IEventFlowOptions eventFlowOptions = options
                .UseEventStoreEventStore(eventStoreClientSettings);

            return eventFlowOptions;
        }
    }

frenchyjef avatar Oct 18 '20 17:10 frenchyjef

@frenchyjef its the change EventStore.Client to EventStore.Client.Grpc.Streams along with the major version bump. Does this change which versions of EventStore that is supported? If yes, then please put it in the release notes as well.

As for the rest of the change, I have never worked with EventStore 😢 and will rely on the community (and extensive integration tests) to validate the functionality.

rasmus avatar Oct 20 '20 06:10 rasmus

Hello there!

We hope this message finds you well. We wanted to let you know that we have noticed that there has been no activity on this pull request for the past 90 days, which makes it a stale pull request.

As a result, we will be closing this pull request within the next seven days. If you still think this pull request is necessary or relevant, please feel free to update it or leave a comment within the next seven days.

Thank you for your contributions and understanding.

Best regards, EventFlow

github-actions[bot] avatar Apr 08 '23 13:04 github-actions[bot]

Hello there! I'm a bot and I wanted to let you know that your pull request has been closed due to inactivity after being marked as stale for seven days. If you believe this was done in error, or if you still plan to work on this pull request, please don't hesitate to reopen it and let us know. We're always happy to review and merge high-quality contributions. Thank you for your interest in our project! Best regards, EventFlow

github-actions[bot] avatar Apr 16 '23 09:04 github-actions[bot]