[
  {
    "path": ".dockerignore",
    "content": "**/.classpath\n**/.dockerignore\n**/.env\n**/.git\n**/.gitignore\n**/.project\n**/.settings\n**/.toolstarget\n**/.vs\n**/.vscode\n**/*.*proj.user\n**/*.dbmdl\n**/*.jfm\n**/azds.yaml\n**/bin\n**/charts\n**/docker-compose*\n**/Dockerfile*\n**/node_modules\n**/npm-debug.log\n**/obj\n**/secrets.dev.yaml\n**/values.dev.yaml\nLICENSE\nREADME.md"
  },
  {
    "path": ".github/workflows/dotnetcore.yml",
    "content": "# This is a basic workflow to help you get started with Actions\n\nname: CI\n\n# Controls when the action will run. Triggers the workflow on push or pull request \n# events but only for the master branch\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\n# A workflow run is made up of one or more jobs that can run sequentially or in parallel\njobs:\n  # This workflow contains a single job called \"build\"\n  build:\n    # The type of runner that the job will run on\n    runs-on: ubuntu-latest\n\n    # Steps represent a sequence of tasks that will be executed as part of the job\n    steps:\n      - uses: actions/checkout@v2\n      \n      - name: Setup .NET Core\n        uses: actions/setup-dotnet@v1\n        with:\n          dotnet-version: 3.1.101\n      \n      - name: Build with dotnet\n        run: dotnet build --configuration Release\n        \n      - name: sonar-scanner\n        uses: Warchant/setup-sonar-scanner@v1\n   \n      - name: Build the stack\n        run: docker-compose -f build/docker-compose.yml up -d\n   \n      - name: Sleep\n        uses: jakejarvis/wait-action@master\n        with:\n          time: '5s'\n\n      - name: Check running containers\n        run: docker ps -a\n\n      - name: Check logs\n        run: docker-compose -f build/docker-compose.yml logs\n\n      - name: Tests\n        run: dotnet test EventFlow.Tests/EventFlow.Tests.csproj --configuration Release\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\n\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n\n# Visual Studio 2015/2017 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# Visual Studio 2017 auto generated files\nGenerated\\ Files/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n**/Properties/launchSettings.json\n\n# StyleCop\nStyleCopReport.xml\n\n# Files built by Visual Studio\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.iobj\n*.pch\n*.pdb\n*.ipdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# Visual Studio Trace Files\n*.e2e\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding add-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n!**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Including strong name files can present a security risk \n# (https://github.com/github/gitignore/pull/2483#issue-259490424)\n#*.snk\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\nServiceFabricBackup/\n*.rptproj.bak\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n*.rptproj.rsuser\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# JetBrains Rider\n.idea/\n*.sln.iml\n\n# CodeRush\n.cr/\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs\n\n# OpenCover UI analysis results\nOpenCover/\n\n# Azure Stream Analytics local run output \nASALocalRun/\n\n# MSBuild Binary and Structured Log\n*.binlog\n\n# NVidia Nsight GPU debugger configuration file\n*.nvuser\n\n# MFractors (Xamarin productivity tool) working folder \n.mfractor/\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/CommandHandlers/ExampleCommandHandler.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing EventFlow.Commands;\nusing EventFlow.Jobs;\nusing EventFlowExample.Aggregates.Commands;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Jobs;\nusing EventFlowExample.Models;\n\nnamespace EventFlowExample.Aggregates.CommandHandlers\n{\n    public class ExampleCommandHandler :\n        CommandHandler<ExampleAggregate, ExampleId, CommandReturnResult, ExampleCommand>\n    {\n        private readonly IJobScheduler _jobScheduler;\n\n        public ExampleCommandHandler(IJobScheduler jobScheduler)\n        {\n            _jobScheduler = jobScheduler;\n        }\n\n        public override async Task<CommandReturnResult> ExecuteCommandAsync(\n            ExampleAggregate aggregate,\n            ExampleCommand command,\n            CancellationToken cancellationToken)\n        {\n            var executionResult = aggregate.SetMagicNumer(command.MagicNumber);\n\n            await _jobScheduler\n                .ScheduleAsync(new ExampleJob(\"Example job\"), TimeSpan.FromSeconds(10), CancellationToken.None)\n                .ConfigureAwait(false);\n\n            return await Task.FromResult(new CommandReturnResult(executionResult.IsSuccess, aggregate));\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/CommandHandlers/ResetCommandHandler.cs",
    "content": "using System.Threading;\nusing System.Threading.Tasks;\nusing EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Commands;\nusing EventFlowExample.Aggregates.Commands;\nusing EventFlowExample.Aggregates.Events;\n\nnamespace EventFlowExample.Aggregates.CommandHandlers\n{\n    public class ResetCommandHandler : CommandHandler<ExampleAggregate, ExampleId, IExecutionResult, ResetCommand>\n    {\n        public override Task<IExecutionResult> ExecuteCommandAsync(\n            ExampleAggregate aggregate,\n            ResetCommand command,\n            CancellationToken cancellationToken)\n        {\n            var executionResult = aggregate.ResetMagicNumber();\n\n            return Task.FromResult(executionResult);\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Commands/ExampleCommand.cs",
    "content": "using EventFlow.Commands;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Models;\n\nnamespace EventFlowExample.Aggregates.Commands\n{\n    public class ExampleCommand : Command<ExampleAggregate, ExampleId, CommandReturnResult>\n    {\n        public ExampleCommand(\n            ExampleId aggregateId,\n            //ISourceId sourceId, //optional\n            int magicNumber)\n            : base(aggregateId\n                  // ,sourceId //optional\n            )\n        {\n            MagicNumber = magicNumber;\n        }\n\n        public int MagicNumber { get; }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Commands/ResetCommand.cs",
    "content": "using EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Commands;\nusing EventFlowExample.Aggregates.Events;\n\nnamespace EventFlowExample.Aggregates.Commands\n{\n    public class ResetCommand : Command<ExampleAggregate, ExampleId, IExecutionResult>\n    {\n        public ResetCommand(\n            ExampleId aggregateId)\n            : base(aggregateId\n            )\n        {\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Decoraters/LogCommandBus.cs",
    "content": "﻿using EventFlow;\nusing EventFlow.Aggregates;\nusing EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Commands;\nusing EventFlow.Core;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample\n{\n    public class LogCommandBus : ICommandBus\n    {\n        private readonly ICommandBus _internalCommandBus;\n\n        public LogCommandBus(ICommandBus commandBus)\n        {\n            _internalCommandBus = commandBus;\n        }\n\n        public Task<TExecutionResult> PublishAsync<TAggregate, TIdentity, TExecutionResult>(ICommand<TAggregate, TIdentity, TExecutionResult> command, CancellationToken cancellationToken)\n            where TAggregate : IAggregateRoot<TIdentity>\n            where TIdentity : IIdentity\n            where TExecutionResult : IExecutionResult\n        {\n            Console.WriteLine(\"**********\" + command.AggregateId.ToString());\n            return _internalCommandBus.PublishAsync<TAggregate, TIdentity, TExecutionResult>(command, cancellationToken);\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Events/ExampleEvent.cs",
    "content": "using EventFlow.Aggregates;\nusing EventFlow.EventStores;\n\nnamespace EventFlowExample.Aggregates.Events\n{\n    [EventVersion(\"example\", 1)]\n    public class ExampleEvent : AggregateEvent<ExampleAggregate, ExampleId>\n    {\n        public ExampleEvent(int magicNumber)\n        {\n            MagicNumber = magicNumber;\n        }\n\n        public int MagicNumber { get; }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Events/ExampleId.cs",
    "content": "using EventFlow.Core;\n\nnamespace EventFlowExample.Aggregates.Events\n{\n    public class ExampleId : IIdentity\n    {\n        public ExampleId(string value)\n        {\n            Value = value;\n        }\n\n        public string Value { get; }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Events/ResetEvent.cs",
    "content": "using EventFlow.Aggregates;\nusing EventFlow.EventStores;\n\nnamespace EventFlowExample.Aggregates.Events\n{\n    [EventVersion(\"reset\", 1)]\n    public class ResetEvent : AggregateEvent<ExampleAggregate, ExampleId>\n    {\n        public ResetEvent()\n        {\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/ExampleAggregate.cs",
    "content": "using EventFlow.Aggregates;\nusing EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Snapshots;\nusing EventFlow.Snapshots.Strategies;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Aggregates.Snapshots;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample.Aggregates\n{\n    public class ExampleAggregate : SnapshotAggregateRoot<ExampleAggregate, ExampleId, ExampleSnaphost>,\n                                    IEmit<ExampleEvent> //optional\n    {\n        #region Aggregate Variables\n        private int? _magicNumber;\n        private int _counter = 0;\n        #endregion\n\n        public ExampleAggregate(ExampleId id) : base(id, SnapshotEveryFewVersionsStrategy.With(SnapshotEveryVersion)) \n        {\n        //    SetSourceIdHistory(int.MaxValue); //optional;\n        }\n\n        #region Snapshots\n        public const int SnapshotEveryVersion = 100;\n        public IReadOnlyCollection<ExampleSnapshotVersion> SnapshotVersions { get; private set; } = new ExampleSnapshotVersion[] { };\n\n        protected override Task<ExampleSnaphost> CreateSnapshotAsync(CancellationToken cancellationToken)\n        {\n            return Task.FromResult(new ExampleSnaphost(\n                                   _magicNumber,\n                                   _counter,\n                                   Enumerable.Empty<ExampleSnapshotVersion>()));\n        }\n\n        protected override Task LoadSnapshotAsync(ExampleSnaphost snapshot, ISnapshotMetadata metadata, CancellationToken cancellationToken)\n        {\n            _magicNumber = snapshot.MagicNumber;\n            _counter = snapshot.Counter;\n\n            SnapshotVersions = snapshot.PreviousVersions;\n\n            return Task.FromResult(0);\n        }\n        #endregion\n\n        // Method invoked by our command\n        public IExecutionResult SetMagicNumer(int magicNumber)\n        {\n            Emit(new ExampleEvent(magicNumber));\n            \n            return ExecutionResult.Success();\n        }\n\n        public IExecutionResult ResetMagicNumber()\n        {\n            Emit(new ResetEvent());\n\n            return ExecutionResult.Success();\n        }\n\n        // We apply the event as part of the event sourcing system. EventFlow\n        // provides several different methods for doing this, e.g. state objects,\n        // the Apply method is merely the simplest\n        public void Apply(ExampleEvent aggregateEvent)\n        {\n            _magicNumber = aggregateEvent.MagicNumber;\n\n            _counter += _magicNumber.Value;\n        }\n\n        public void Apply(ResetEvent aggregateEvent)\n        {\n            _magicNumber = 0;\n\n            _counter = 0;\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/ReadModels/ExampleReadModel.cs",
    "content": "// The MIT License (MIT)\nusing EventFlow.Aggregates;\nusing EventFlow.ReadStores;\nusing EventFlowExample.Aggregates.Events;\nusing System.Collections.Generic;\n\nnamespace EventFlowExample.Aggregates.ReadModels\n{\n    public class ExampleReadModel :\n        IReadModel,\n        IAmReadModelFor<ExampleAggregate, ExampleId, ExampleEvent>\n    {\n        public List<int> MagicNumber { get; private set; } = new List<int>();\n\n        public void Apply(\n            IReadModelContext context,\n            IDomainEvent<ExampleAggregate, ExampleId, ExampleEvent> domainEvent)\n        {\n            MagicNumber.Add(domainEvent.AggregateEvent.MagicNumber);\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/Events/ExampleSagaCompletedEvent.cs",
    "content": "using EventFlow.Aggregates;\nusing EventFlow.EventStores;\n\nnamespace EventFlowExample.Aggregates.Sagas.Events\n{\n    [EventVersion(\"example_saga_completed\", 1)]\n    public class ExampleSagaCompletedEvent : AggregateEvent<ExampleSaga, ExampleSagaId>\n    {\n        public ExampleSagaCompletedEvent()\n        {\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/Events/ExampleSagaStartedEvent.cs",
    "content": "using EventFlow.Aggregates;\nusing EventFlow.EventStores;\n\nnamespace EventFlowExample.Aggregates.Sagas.Events\n{\n    [EventVersion(\"example_saga_started\", 1)]\n    public class ExampleSagaStartedEvent : AggregateEvent<ExampleSaga, ExampleSagaId>\n    {\n        public ExampleSagaStartedEvent(int magicNumber)\n        {\n            MagicNumber = magicNumber;\n        }\n\n        public int MagicNumber { get; }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/ExampleSaga.cs",
    "content": "﻿using EventFlow.Aggregates;\nusing EventFlow.Exceptions;\nusing EventFlow.Sagas;\nusing EventFlow.Sagas.AggregateSagas;\nusing EventFlowExample.Aggregates.Commands;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Aggregates.Sagas.Events;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample.Aggregates.Sagas\n{\n    public class ExampleSaga : AggregateSaga<ExampleSaga, ExampleSagaId, OrderSagaLocator>,\n                               ISagaIsStartedBy<ExampleAggregate, ExampleId, ExampleEvent>,\n                               ISagaHandles<ExampleAggregate, ExampleId, ResetEvent>,\n                               IEmit<ExampleSagaStartedEvent>\n    {\n         int MagicNumber { get; set; }\n       \n         public ExampleSaga(ExampleSagaId id) : base(id)\n         {\n         }\n       \n         public Task HandleAsync(\n             IDomainEvent<ExampleAggregate, ExampleId, ExampleEvent> domainEvent,\n             ISagaContext sagaContext,\n             CancellationToken cancellationToken)\n         {\n             // This check is redundant! We do it to verify EventFlow works correctly\n             if (State != SagaState.New) \n                 throw DomainError.With(\"Saga must be new!\");\n       \n             Emit(new ExampleSagaStartedEvent(domainEvent.AggregateEvent.MagicNumber));\n       \n             Publish(new ResetCommand(domainEvent.AggregateIdentity));\n       \n             return Task.CompletedTask;\n         }\n       \n         public Task HandleAsync(\n            IDomainEvent<ExampleAggregate, ExampleId, ResetEvent> domainEvent,\n            ISagaContext sagaContext,\n            CancellationToken cancellationToken)\n        {\n            // This check is redundant! We do it to verify EventFlow works correctly\n            if (State != SagaState.Running) throw DomainError.With(\"Saga must be running!\");\n\n            Emit(new ExampleSagaCompletedEvent());\n\n            return Task.FromResult(0);\n        }\n\n        public void Apply(ExampleSagaStartedEvent @event)\n        {\n            // Update our aggregate state with relevant order details\n            MagicNumber = @event.MagicNumber;\n        }\n\n        public void Apply(ExampleSagaCompletedEvent @event)\n        {\n            Complete();\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/ExampleSagaId.cs",
    "content": "﻿using EventFlow.Sagas;\nusing EventFlow.ValueObjects;\n\nnamespace EventFlowExample.Aggregates.Sagas\n{\n    public class ExampleSagaId : SingleValueObject<string>, ISagaId\n    {\n        public ExampleSagaId(string value) : base(value)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/SagaExtension.cs",
    "content": "﻿using EventFlow;\nusing EventFlow.Extensions;\nusing EventFlowExample.Aggregates.Sagas.Events;\n\nnamespace EventFlowExample.Aggregates.Sagas\n{\n    public static class SagaExtension\n    {\n        public static IEventFlowOptions ConfigureSagas(this IEventFlowOptions options)\n        {\n            IEventFlowOptions eventFlowOptions = options.AddEvents(typeof(ExampleSagaStartedEvent))\n                                                  .AddEvents(typeof(ExampleSagaCompletedEvent))\n                                                  .AddSagas(typeof(ExampleSaga))\n                                                  .RegisterServices(sr =>\n                                                  {\n                                                      sr.RegisterType(typeof(OrderSagaLocator));\n                                                  });\n\n            return eventFlowOptions;\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Sagas/SagaLocator.cs",
    "content": "﻿using EventFlow.Aggregates;\nusing EventFlow.Sagas;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample.Aggregates.Sagas\n{\n    public class OrderSagaLocator : ISagaLocator\n    {\n        public Task<ISagaId> LocateSagaAsync(\n          IDomainEvent domainEvent,\n          CancellationToken cancellationToken)\n        {\n            //TODO:\n            var event_version = domainEvent.Metadata[\"event_version\"];\n            var orderSagaId = new ExampleSagaId($\"saga-{event_version}\");\n\n            return Task.FromResult<ISagaId>(orderSagaId);\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Snapshots/ExampleSnapshot.cs",
    "content": "﻿using EventFlow.Snapshots;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace EventFlowExample.Aggregates.Snapshots\n{\n    [Serializable]\n    [SnapshotVersion(\"example\", 1)]\n    public class ExampleSnaphost : ISnapshot\n    {\n        #region Variables\n        public int? MagicNumber { get; }\n        public int Counter { get; }\n       \n        public IReadOnlyCollection<ExampleSnapshotVersion> PreviousVersions { get; }\n        #endregion\n\n        public ExampleSnaphost(int? magicNumber,    \n                               int counter, \n                               IEnumerable<ExampleSnapshotVersion> previousVersions)\n        {\n            MagicNumber = magicNumber;\n            Counter = counter;\n            PreviousVersions = (previousVersions ?? Enumerable.Empty<ExampleSnapshotVersion>()).ToList();\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Snapshots/ExampleSnapshotVersion.cs",
    "content": "﻿namespace EventFlowExample.Aggregates.Snapshots\n{\n    public enum ExampleSnapshotVersion\n    {\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Aggregates/Subscribers/ExampleSyncSubscriber.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing EventFlow.Aggregates;\nusing EventFlow.Subscribers;\nusing EventFlowExample.Aggregates.Events;\n\nnamespace EventFlowExample.Aggregates.Subscribers\n{\n    public class ExampleSyncSubscriber : ISubscribeSynchronousTo<ExampleAggregate, ExampleId, ExampleEvent>\n    {\n        public Task HandleAsync(IDomainEvent<ExampleAggregate, ExampleId, ExampleEvent> domainEvent, CancellationToken cancellationToken)\n        {\n            return Task.Run(() =>\n            { \n                Console.WriteLine(\"++++++++\" + domainEvent.ToString());\n            });\n        }            \n    }\n}"
  },
  {
    "path": "EventFlow.Example/EventFlow.Example.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>netcoreapp2.2</TargetFramework>\n    <Authors>Oktay Kır</Authors>\n\t<RootNamespace>EventFlowExample</RootNamespace>\n  </PropertyGroup>\n  \n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|AnyCPU'\">\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Autofac\" Version=\"4.9.4\" />\n    <PackageReference Include=\"BenchmarkDotNet\" Version=\"0.12.0\" />\n    <PackageReference Include=\"coverlet.collector\" Version=\"1.1.0\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"EventFlow\" Version=\"0.77.4077\" />\n    <PackageReference Include=\"EventFlow.Autofac\" Version=\"0.77.4023\" />\n    <PackageReference Include=\"EventFlow.MongoDB\" Version=\"0.76.4014\" />\n    <PackageReference Include=\"EventFlow.RabbitMQ\" Version=\"0.77.4023\" />\n    <PackageReference Include=\"EventStore.Client\" Version=\"5.0.5\" />\n    <PackageReference Include=\"FluentAssertions\" Version=\"5.9.0\" />\n    <PackageReference Include=\"Microsoft.Extensions.Hosting.Abstractions\" Version=\"3.0.0\" />\n    <PackageReference Include=\"Microsoft.VisualStudio.Azure.Containers.Tools.Targets\" Version=\"1.9.5\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\EventStore\\EventStore.csproj\" />\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "EventFlow.Example/Jobs/ExampleJobs.cs",
    "content": "﻿using EventFlow.Configuration;\nusing EventFlow.Jobs;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample.Jobs\n{\n    [JobVersion(\"ExampleJob\", 1)]\n    public class ExampleJob : IJob\n    {\n        public ExampleJob(string message)\n        {\n            Message = message;\n        }\n\n        public string Message { get; }\n\n        public Task ExecuteAsync(\n          IResolver resolver,\n          CancellationToken cancellationToken)\n        {\n            Console.WriteLine(Message);\n\n            return Task.CompletedTask;\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Models/CommandReturnResult.cs",
    "content": "﻿using EventFlow.Aggregates;\nusing EventFlow.Aggregates.ExecutionResults;\n\nnamespace EventFlowExample.Models\n{\n    public class CommandReturnResult : ExecutionResult\n    {\n        public CommandReturnResult(bool isSuccess, IAggregateRoot aggregateRoot)\n        {\n            IsSuccess = isSuccess;\n            AggregateRoot = aggregateRoot;\n        }\n\n        public override bool IsSuccess { get; }\n        public IAggregateRoot AggregateRoot { get; }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Example/Program.cs",
    "content": "﻿namespace EventFlowExample\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            new PublishCommand().PublishCommandAsync().Wait();\n        }\n    }\n}"
  },
  {
    "path": "EventFlow.Example/PublishCommand.cs",
    "content": "﻿using Autofac;\nusing EventFlow;\nusing EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Autofac.Extensions;\nusing EventFlow.Configuration;\nusing EventFlow.EventStores;\nusing EventFlow.Extensions;\nusing EventFlow.MongoDB.Extensions;\nusing EventFlow.RabbitMQ;\nusing EventFlow.RabbitMQ.Extensions;\nusing EventFlow.Snapshots.Strategies;\nusing EventFlowExample.Aggregates.CommandHandlers;\nusing EventFlowExample.Aggregates.Commands;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Aggregates.Snapshots;\nusing EventFlowExample.Jobs;\nusing MongoDB.Driver;\nusing System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace EventFlowExample\n{\n    public class PublishCommand\n    {\n        #region Variables\n        ICommandBus CommandBus { get; set; }\n        private const string SNAPSHOT_CONTAINER_NAME = \"snapshots\";\n        #endregion\n\n        public PublishCommand() \n        {\n        }\n\n        public static ExampleId GetStreamName(string tenantName, string eventName, Guid? aggregateId = null) =>\n            new ExampleId($\"{tenantName.ToLowerInvariant()}_{eventName.ToLowerInvariant()}-{(aggregateId.HasValue ? aggregateId.ToString() : Guid.NewGuid().ToString())}\");\n\n        void DecorateCommandBus(IServiceRegistration sr)\n        {\n            sr.Decorate<ICommandBus>((r, cb) => new LogCommandBus(cb));\n        }\n\n        public async Task PublishCommandAsync()\n        {\n            var client = new MongoClient(\"mongodb://localhost:27017\");\n\n            using (var resolver = EventFlowOptions.New\n                                                  .UseAutofacContainerBuilder(new ContainerBuilder()) // Must be the first line!\n                                                  .Configure(c => c.ThrowSubscriberExceptions = true)\n                                                  .AddEvents(typeof(ExampleEvent))\n                                                  .AddEvents(typeof(ResetEvent))\n                                                  .AddCommands(typeof(ExampleCommand))\n                                                  .AddCommands(typeof(ResetCommand))\n                                                  .AddCommandHandlers(typeof(ExampleCommandHandler))\n                                                  .AddCommandHandlers(typeof(ResetCommandHandler))\n                                                  .ConfigureEventStore()\n                                                  .ConfigureMongoDb(client, SNAPSHOT_CONTAINER_NAME)\n                                                  .AddSnapshots(typeof(ExampleSnaphost))\n                                                  .UseMongoDbSnapshotStore()\n                                                  .RegisterServices(sr => sr.Register(i => SnapshotEveryFewVersionsStrategy.Default))\n                                                  .RegisterServices(DecorateCommandBus)\n                                                  .PublishToRabbitMq(RabbitMqConfiguration.With(new Uri(@\"amqp://test:test@localhost:5672\"), true, 4, \"eventflow\"))\n                                                  //.ConfigureSagas()\n                                                  //.UseNullLog()\n                                                  //.UseInMemoryReadStoreFor<Aggregates.ReadModels.ExampleReadModel>()\n                                                  .Configure(c => c.IsAsynchronousSubscribersEnabled = true)\n                                                  //.AddAsynchronousSubscriber<ExampleAggregate, Aggregates.Events.ExampleId, ExampleEvent, RabbitMqConsumePersistanceService>()\n                                                  //.RegisterServices(s => {\n                                                  //    s.Register<IHostedService, RabbitConsumePersistenceService>(Lifetime.Singleton);\n                                                  //    s.Register<IHostedService, RabbitMqConsumePersistanceService>(Lifetime.Singleton);\n                                                  //})\n                                                  //.AddSubscribers(new Type[] { typeof(ExampleSyncSubscriber) })\n                                                 // .UseHangfireJobScheduler()\n                                                  .AddJobs(typeof(ExampleJob))\n                                                  .CreateResolver())\n            {\n                Int32 magicNumber = 2;\n                CommandBus = resolver.Resolve<ICommandBus>();\n\n                var clock = new Stopwatch();\n                clock.Start();\n\n                ExampleId exampleId = GetStreamName(\"Tenant\", \"EXAMPLE\");\n\n                for (int i = 0; i < 1; i++)\n                {\n\n                    IExecutionResult result = await CommandBus.PublishAsync(\n                        new ExampleCommand(exampleId, magicNumber), CancellationToken.None)\n                        .ConfigureAwait(false);\n                    #region Comments\n                    //result.IsSuccess.Should().BeTrue();\n\n                    //IAggregateStore aggregateStore = resolver.Resolve<IAggregateStore>();\n                    //var @object = aggregateStore.LoadAsync<ExampleAggregate, ExampleId>(exampleId, CancellationToken.None);\n\n                    ////Obsolete\n                    ////IEventStore eventStore = resolver.Resolve<IEventStore>();\n                    ////var aggregate = await eventStore.LoadAggregateAsync<ExampleAggregate, ExampleId>(exampleId, CancellationToken.None);\n\n                    ////state of our aggregate root\n                    //var queryProcessor = resolver.Resolve<IQueryProcessor>();\n                    //var result = await queryProcessor.ProcessAsync(\n                    //     new ReadModelByIdQuery<ExampleReadModel>(exampleId),\n                    //     CancellationToken.None)\n                    //     .ConfigureAwait(false);\n\n                    //// Verify that the read model has the expected magic number\n                    //exampleReadModel.MagicNumber.Should().Be(42);\n                    #endregion\n                }\n\n                clock.Stop();\n\n                Console.WriteLine(\"Duration: \" + clock.ElapsedMilliseconds + \"ms\");\n            }\n\n            Console.ReadLine();\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Tests/EventFlow.Tests.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>netcoreapp3.1</TargetFramework>\n\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"EventFlow\" Version=\"0.77.4077\" />\n    <PackageReference Include=\"EventFlow.Autofac\" Version=\"0.77.4023\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"16.5.0\" />\n    <PackageReference Include=\"MongoDB.Driver\" Version=\"2.10.4\" />\n    <PackageReference Include=\"xunit\" Version=\"2.4.0\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"2.4.0\" />\n    <PackageReference Include=\"coverlet.collector\" Version=\"1.1.0\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\EventFlow.Example\\EventFlow.Example.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "EventFlow.Tests/IntegrationTestBase.cs",
    "content": "﻿using EventFlow.Configuration;\nusing System;\nusing EventFlowExample;\nusing MongoDB.Driver;\n\nnamespace EventFlow.Tests\n{\n    public abstract class IntegrationTestBase : IDisposable\n    {\n        #region Variables\n        public ICommandBus CommandBus { get; set; }\n        public const string SNAPSHOT_CONTAINER_NAME = \"snapshots\";\n        public Uri RabbitMqUri = new Uri(@\"amqp://test:test@localhost:5672\");\n        public MongoClient MongoClient => new MongoClient(\"mongodb://localhost:27017\");\n        #endregion\n\n        public void DecorateCommandBus(IServiceRegistration sr)\n        {\n            sr.Decorate<ICommandBus>((r, cb) => new LogCommandBus(cb));\n        }\n\n        public virtual void Dispose(bool isDisposing)\n        {\n            if (!isDisposing)\n                return;\n        }\n\n        public void Dispose()\n        {\n            Dispose(true);\n        }\n    }\n}\n"
  },
  {
    "path": "EventFlow.Tests/IntegrationTests.cs",
    "content": "using Autofac;\nusing CommandLine.Text;\nusing EventFlow.Aggregates;\nusing EventFlow.Autofac.Extensions;\nusing EventFlow.EventStores;\nusing EventFlow.Extensions;\nusing EventFlow.MongoDB.Extensions;\nusing EventFlow.Queries;\nusing EventFlow.RabbitMQ;\nusing EventFlow.RabbitMQ.Extensions;\nusing EventFlow.Snapshots.Strategies;\nusing EventFlowExample;\nusing EventFlowExample.Aggregates;\nusing EventFlowExample.Aggregates.CommandHandlers;\nusing EventFlowExample.Aggregates.Commands;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Aggregates.ReadModels;\nusing EventFlowExample.Aggregates.Snapshots;\nusing EventFlowExample.Jobs;\nusing EventFlowExample.Models;\nusing FluentAssertions;\nusing System;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace EventFlow.Tests\n{\n    public class IntegrationTests : IntegrationTestBase\n    {\n        [Fact]\n        public async Task PassingTest()\n        {\n            using (var resolver = EventFlowOptions.New\n                                                  .UseAutofacContainerBuilder(new ContainerBuilder())\n                                                  .Configure(c => c.ThrowSubscriberExceptions = true)\n                                                  .AddEvents(typeof(ExampleEvent))\n                                                  .AddEvents(typeof(ResetEvent))\n                                                  .AddCommands(typeof(ExampleCommand))\n                                                  .AddCommands(typeof(ResetCommand))\n                                                  .AddCommandHandlers(typeof(ExampleCommandHandler))\n                                                  .AddCommandHandlers(typeof(ResetCommandHandler))\n                                                  .ConfigureEventStore()\n                                                  .ConfigureMongoDb(MongoClient, SNAPSHOT_CONTAINER_NAME)\n                                                  .AddSnapshots(typeof(ExampleSnaphost))\n                                                  .UseMongoDbSnapshotStore()\n                                                  .UseInMemoryReadStoreFor<ExampleReadModel>()\n                                                  .RegisterServices(sr => sr.Register(i => SnapshotEveryFewVersionsStrategy.Default))\n                                                  .RegisterServices(DecorateCommandBus)\n                                                  .PublishToRabbitMq(RabbitMqConfiguration.With(RabbitMqUri, true, 4, \"eventflow\"))\n                                                  .Configure(c => c.IsAsynchronousSubscribersEnabled = true)\n                                                  .AddJobs(typeof(ExampleJob))\n                                                  .CreateResolver())\n            {\n                Int32 magicNumber = 2;\n                CommandBus = resolver.Resolve<ICommandBus>();\n                \n                ExampleId exampleId = PublishCommand.GetStreamName(\"Tenant\", \"EXAMPLE\");\n\n                CommandReturnResult result = await CommandBus.PublishAsync(\n                       new ExampleCommand(exampleId, magicNumber), CancellationToken.None)\n                       .ConfigureAwait(false);\n\n                IAggregateStore aggregateStore = resolver.Resolve<IAggregateStore>();\n                var @aggregate = await aggregateStore.LoadAsync<ExampleAggregate, ExampleId>(exampleId, CancellationToken.None);\n\n                //Command side\n                result.IsSuccess.Should().BeTrue();\n                result.AggregateRoot.Should().NotBeNull();\n                result.AggregateRoot.Version.Should().Be(1);\n                result.AggregateRoot.Name.Value.Should().Be(\"ExampleAggregate\");\n                result.AggregateRoot.GetIdentity().Value.Should().Be(exampleId.Value);\n                @aggregate.Should().NotBeNull();\n                result.AggregateRoot.Should().Equals(@aggregate);\n            }\n        }\n\n        [Fact]\n        public async Task ReadModelTest()\n        {\n            using (var resolver = EventFlowOptions.New\n                                                  .UseAutofacContainerBuilder(new ContainerBuilder())\n                                                  .Configure(c => c.ThrowSubscriberExceptions = true)\n                                                  .AddEvents(typeof(ExampleEvent))\n                                                  .AddEvents(typeof(ResetEvent))\n                                                  .AddCommands(typeof(ExampleCommand))\n                                                  .AddCommands(typeof(ResetCommand))\n                                                  .AddCommandHandlers(typeof(ExampleCommandHandler))\n                                                  .AddCommandHandlers(typeof(ResetCommandHandler))\n                                                  .ConfigureEventStore()\n                                                  .ConfigureMongoDb(MongoClient, SNAPSHOT_CONTAINER_NAME)\n                                                  .AddSnapshots(typeof(ExampleSnaphost))\n                                                  .UseMongoDbSnapshotStore()\n                                                  .UseInMemoryReadStoreFor<ExampleReadModel>()\n                                                  .RegisterServices(sr => sr.Register(i => SnapshotEveryFewVersionsStrategy.Default))\n                                                  .RegisterServices(DecorateCommandBus)\n                                                  .PublishToRabbitMq(RabbitMqConfiguration.With(RabbitMqUri, true, 4, \"eventflow\"))\n                                                  .Configure(c => c.IsAsynchronousSubscribersEnabled = true)\n                                                  .AddJobs(typeof(ExampleJob))\n                                                  .CreateResolver())\n            {\n                Int32 magicNumber = 2;\n                CommandBus = resolver.Resolve<ICommandBus>();\n\n                ExampleId exampleId = PublishCommand.GetStreamName(\"Tenant\", \"EXAMPLE\");\n\n                CommandReturnResult result = await CommandBus.PublishAsync(\n                       new ExampleCommand(exampleId, magicNumber), CancellationToken.None)\n                       .ConfigureAwait(false);\n\n                var queryProcessor = resolver.Resolve<IQueryProcessor>();\n                ExampleReadModel exampleReadModel = await queryProcessor.ProcessAsync(\n                     new ReadModelByIdQuery<ExampleReadModel>(exampleId),\n                     CancellationToken.None)\n                     .ConfigureAwait(false);\n\n                exampleReadModel.Should().NotBeNull();\n                exampleReadModel.MagicNumber.Should().ContainSingle();\n                exampleReadModel.MagicNumber.First().Should().Be(2);\n            }\n        }\n    }\n}"
  },
  {
    "path": "EventFlowExamples.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30104.148\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"EventFlow.Example\", \"EventFlow.Example\\EventFlow.Example.csproj\", \"{F67006E8-2887-4B2C-8049-63BDC8AE0F00}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"EventStore\", \"EventStore\\EventStore.csproj\", \"{DF87F930-BF1C-4932-9C51-75591E14FEAE}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"EventFlow.Tests\", \"EventFlow.Tests\\EventFlow.Tests.csproj\", \"{2B5AB9C1-0C47-4475-A3F9-3A72C34E15F6}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F67006E8-2887-4B2C-8049-63BDC8AE0F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F67006E8-2887-4B2C-8049-63BDC8AE0F00}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F67006E8-2887-4B2C-8049-63BDC8AE0F00}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F67006E8-2887-4B2C-8049-63BDC8AE0F00}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{DF87F930-BF1C-4932-9C51-75591E14FEAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{DF87F930-BF1C-4932-9C51-75591E14FEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{DF87F930-BF1C-4932-9C51-75591E14FEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{DF87F930-BF1C-4932-9C51-75591E14FEAE}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{2B5AB9C1-0C47-4475-A3F9-3A72C34E15F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2B5AB9C1-0C47-4475-A3F9-3A72C34E15F6}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2B5AB9C1-0C47-4475-A3F9-3A72C34E15F6}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2B5AB9C1-0C47-4475-A3F9-3A72C34E15F6}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {9DC7F542-AB1D-4C23-81B9-1889AEC99EEF}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "EventStore/EventStore.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>netstandard2.0</TargetFramework>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"EventFlow.EventStores.EventStore\" Version=\"0.77.4023\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "EventStore/EventStoreExtension.cs",
    "content": "﻿using System;\nusing System.Data.Common;\nusing EventFlow;\nusing EventFlow.EventStores.EventStore.Extensions;\nusing EventFlow.Extensions;\nusing EventFlow.MetadataProviders;\nusing EventStore.ClientAPI;\nusing EventStore.ClientAPI.SystemData;\n\nnamespace EventFlow.EventStores\n{\n    public static class EventStoreExtension\n    {\n        public static IEventFlowOptions ConfigureEventStore(this IEventFlowOptions options)\n        {\n            string eventStoreUrl = \"tcp://localhost:1113\";\n            string connectionString = $\"ConnectTo={eventStoreUrl}; HeartBeatTimeout=500\";\n            Uri eventStoreUri = GetUriFromConnectionString(connectionString);\n\n            var connectionSettings = ConnectionSettings.Create()\n                .EnableVerboseLogging()\n                .KeepReconnecting()\n                .KeepRetrying()\n                .SetDefaultUserCredentials(new UserCredentials(\"admin\", \"changeit\"))\n                .Build();\n\n            IEventFlowOptions eventFlowOptions = options\n                .AddMetadataProvider<AddGuidMetadataProvider>()\n                .UseEventStoreEventStore(eventStoreUri, connectionSettings);\n\n            return eventFlowOptions;\n        }\n\n        private static Uri GetUriFromConnectionString(string connectionString)\n        {\n            DbConnectionStringBuilder builder = new DbConnectionStringBuilder { ConnectionString = connectionString };\n            string connectTo = (string)builder[\"ConnectTo\"];\n\n            return connectTo == null ? null : new Uri(connectTo);\n        }\n    }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2019] [Oktay Kır]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# EventFlow.Example\n![Hits](https://hitcounter.pythonanywhere.com/count/tag.svg?url=https://github.com/OKTAYKIR/EventFlow.Example)\n![GitHub issues](https://img.shields.io/github/issues/OKTAYKIR/EventFlow.Example)\n![Build Status](https://github.com/OKTAYKIR/EventFlow.Example/workflows/CI/badge.svg)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)\n\nDDD+CQRS+Event-sourcing examples using EventFlow following CQRS-ES architecture. It is configured with RabbitMQ, MongoDB(Snapshot store), PostgreSQL(Read store), EventStore(GES). It's targeted to .Net Core 2.2 and include [docker compose file](/build/docker-compose.yml).\n\n## Event Sourcing/CQRS Architecture\nThe most common CQRS/ES architecture would look like following diagram\n![OverallArchitecture](https://github.com/OKTAYKIR/EventFlow.Example/blob/master/Images/architecture_diagram.png)\n\nThe example consists of the following concepts, each shown below\n\n- Aggregates\n- Command bus and commands\n- Synchronous subscriber\n- Event store ([GES](https://eventstore.com/))\n- In-memory read model.\n- Snapshots ([MongoDb](https://www.mongodb.com/))\n- Sagas\n- Event publising (In-memory, [RabbitMq](https://www.rabbitmq.com/))\n- Metadata\n- Command bus decorator, custom value object, custom execution result, ...\n\n## Configuration\n```csharp\nvar resolver = EventFlowOptions.New\n    .UseAutofacContainerBuilder(new ContainerBuilder())\n    .Configure(c => c.ThrowSubscriberExceptions = true)\n    .AddEvents(typeof(ExampleEvent))\n    .AddEvents(typeof(ResetEvent))\n    .AddCommands(typeof(ExampleCommand))\n    .AddCommands(typeof(ResetCommand))\n    .AddCommandHandlers(typeof(ExampleCommandHandler))\n    .AddCommandHandlers(typeof(ResetCommandHandler))\n    .ConfigureEventStore()\n    .ConfigureMongoDb(client, SNAPSHOT_CONTAINER_NAME)\n    .AddSnapshots(typeof(ExampleSnaphost))\n    .UseMongoDbSnapshotStore()\n    .RegisterServices(sr => sr.Register(i => SnapshotEveryFewVersionsStrategy.Default))\n    .RegisterServices(DecorateCommandBus)\n    .PublishToRabbitMq(RabbitMqConfiguration.With(new Uri(@\"amqp://test:test@localhost:5672\"), true, 4, \"eventflow\"))\n    .UseInMemoryReadStoreFor<Aggregates.ReadModels.ExampleReadModel>()\n    .AddJobs(typeof(ExampleJob))\n    .CreateResolver());\n```\n\n## 📦 Stack\n* [EventFlow](https://github.com/eventflow/EventFlow)\n* [EventStore](https://eventstore.com)\n* [RabbitMQ](https://www.rabbitmq.com)\n* [MongoDB](https://www.mongodb.com)\n* [PostgreSQL](https://www.postgresql.org)\n* [Docker](https://www.docker.com)\n\n## 🤝 Contributing\n1. Fork it ( https://github.com/OKTAYKIR/EventFlow.Example/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request \n\n## ✨ Contributors\n![GitHub Contributors Image](https://contrib.rocks/image?repo=OKTAYKIR/EventFlow.Example)\n\n## Show your support\nPlease ⭐️ this repository if this project helped you!\n\n## 📝 License\nApache-2.0 © [Oktay Kır](https://www.linkedin.com/in/oktay-kır-phd-9402955a)\n"
  },
  {
    "path": "SyncEventHandler/ExampleAggregate.cs",
    "content": "//// The MIT License (MIT)\n//// \n//// Copyright (c) 2015-2017 Rasmus Mikkelsen\n//// Copyright (c) 2015-2017 eBay Software Foundation\n//// https://github.com/eventflow/EventFlow\n//// \n//// Permission is hereby granted, free of charge, to any person obtaining a copy of\n//// this software and associated documentation files (the \"Software\"), to deal in\n//// the Software without restriction, including without limitation the rights to\n//// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n//// the Software, and to permit persons to whom the Software is furnished to do so,\n//// subject to the following conditions:\n//// \n//// The above copyright notice and this permission notice shall be included in all\n//// copies or substantial portions of the Software.\n//// \n//// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n//// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n//// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n//// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n//// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n//using EventFlow.Aggregates;\n//using EventFlow.Aggregates.ExecutionResults;\n//using SyncEventHandler;\n\n//namespace EventFlow.Documentation.GettingStarted\n//{\n//    /// The aggregate root\n//    public class ExampleAggregate :\n//        AggregateRoot<ExampleAggregate, WizloId>,\n//        IEmit<ExampleEvent> //optional\n//    {\n//        private int? _magicNumber;\n\n//        public ExampleAggregate(WizloId id) : base(id) {\n//        //    SetSourceIdHistory(int.MaxValue); //optional;\n//        }\n\n//        // Method invoked by our command\n//        public IExecutionResult SetMagicNumer(int magicNumber)\n//        {\n//            if (_magicNumber.HasValue)\n//                return ExecutionResult.Failed(\"Magic number already set\");\n\n//            Emit(new ExampleEvent(magicNumber));\n            \n//            return ExecutionResult.Success();\n//        }\n\n//        // We apply the event as part of the event sourcing system. EventFlow\n//        // provides several different methods for doing this, e.g. state objects,\n//        // the Apply method is merely the simplest\n//        public void Apply(ExampleEvent aggregateEvent)\n//        {\n//            _magicNumber = aggregateEvent.MagicNumber;\n//        }\n//    }\n//}"
  },
  {
    "path": "SyncEventHandler/ExampleEvent.cs",
    "content": "//// The MIT License (MIT)\n//// \n//// Copyright (c) 2015-2017 Rasmus Mikkelsen\n//// Copyright (c) 2015-2017 eBay Software Foundation\n//// https://github.com/eventflow/EventFlow\n//// \n//// Permission is hereby granted, free of charge, to any person obtaining a copy of\n//// this software and associated documentation files (the \"Software\"), to deal in\n//// the Software without restriction, including without limitation the rights to\n//// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n//// the Software, and to permit persons to whom the Software is furnished to do so,\n//// subject to the following conditions:\n//// \n//// The above copyright notice and this permission notice shall be included in all\n//// copies or substantial portions of the Software.\n//// \n//// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n//// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n//// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n//// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n//// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//// \n\n//using EventFlow.Aggregates;\n//using EventFlow.EventStores;\n//using SyncEventHandler;\n\n//namespace EventFlow.Documentation.GettingStarted\n//{\n//    /// A basic event containing some information\n//    [EventVersion(\"example\", 1)]\n//    public class ExampleEvent :\n//        AggregateEvent<ExampleAggregate, WizloId>\n//    {\n//        public ExampleEvent(int magicNumber)\n//        {\n//            MagicNumber = magicNumber;\n//        }\n\n//        public int MagicNumber { get; }\n//    }\n//}"
  },
  {
    "path": "SyncEventHandler/ExampleSyncSubscriber.cs",
    "content": "// The MIT License (MIT)\n// \n// Copyright (c) 2015-2017 Rasmus Mikkelsen\n// Copyright (c) 2015-2017 eBay Software Foundation\n// https://github.com/eventflow/EventFlow\n// \n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n// \n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing EventFlow.Aggregates;\nusing EventFlow.Aggregates.ExecutionResults;\nusing EventFlow.Subscribers;\nusing EventFlowExample.Aggregates;\nusing EventFlowExample.Aggregates.Events;\nusing SyncEventHandler;\n\nnamespace EventFlow.Documentation.GettingStarted\n{\n    public class ExampleSyncSubscriber : ISubscribeSynchronousTo<ExampleAggregate, WizloId, ExampleEvent>\n    {\n        public Task HandleAsync(IDomainEvent<ExampleAggregate, WizloId, ExampleEvent> domainEvent, CancellationToken cancellationToken)\n        {\n            return Task.Run(() =>\n            { \n                Console.WriteLine(\"+++++++++++++++++++++++++++++++++++++++++++++++\" + domainEvent.ToString());\n            });\n        }            \n    }\n}"
  },
  {
    "path": "SyncEventHandler/Program.cs",
    "content": "﻿using EventFlow;\nusing EventFlow.Aggregates;\nusing EventFlow.Configuration;\nusing EventFlow.EventStores;\nusing EventFlow.Extensions;\nusing EventFlow.Hangfire.Extensions;\nusing EventFlow.RabbitMQ;\nusing EventFlow.RabbitMQ.Integrations;\nusing EventFlow.Subscribers;\nusing EventFlowExample.Aggregates;\nusing EventFlowExample.Aggregates.Events;\nusing EventFlowExample.Jobs;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Hosting;\nusing RabbitMQ.Client;\nusing RabbitMQ.Client.Events;\nusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace SyncEventHandler\n{\n    class Program\n    {\n        public static async Task Main(string[] args)\n        {\n            var builder = new HostBuilder()\n               .ConfigureAppConfiguration((host, config) =>\n               {\n                   config.SetBasePath(Directory.GetCurrentDirectory());\n               })\n               .ConfigureServices(\n                   (hostcontext, services) =>\n                   {\n                       EventFlowOptions.New\n                            .UseHangfireJobScheduler()\n                            .AddJobs(typeof(ExampleJob));\n                            //.Configure(cfg => cfg.IsAsynchronousSubscribersEnabled = true)\n                            //.PublishToRabbitMq(RabbitMqConfiguration.With(new Uri(@\"amqp://test:test@localhost:5672\"), true, 4, \"eventflow\"))\n                            //.AddAsynchronousSubscriber<ExampleAggregate, WizloId, ExampleEvent, RabbitMqConsumePersistanceService>()\n                            //.RegisterServices(s =>\n                            //{\n                            //    s.Register<IHostedService, RabbitConsumePersistenceService>(Lifetime.Singleton);\n                            //    s.Register<IHostedService, RabbitMqConsumePersistanceService>(Lifetime.Singleton);\n                            //});\n                   })\n               .ConfigureLogging((hostingContext, logging) => { });\n\n            await builder.RunConsoleAsync();\n\n            Console.ReadLine();\n        }\n    }\n}\n"
  },
  {
    "path": "SyncEventHandler/SyncEventHandler.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>netcoreapp2.2</TargetFramework>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"EventFlow\" Version=\"0.77.4077\" />\n    <PackageReference Include=\"EventFlow.RabbitMQ\" Version=\"0.77.4023\" />\n    <PackageReference Include=\"Microsoft.Extensions.Hosting\" Version=\"3.0.0\" />\n    <PackageReference Include=\"Microsoft.Extensions.Hosting.Abstractions\" Version=\"3.0.0\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\EventFlow.Example\\EventFlow.Example.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "_config.yml",
    "content": "theme: jekyll-theme-slate"
  },
  {
    "path": "build/docker-compose.yml",
    "content": "version: '3'\n\nservices:\n  \n  rabbitmq:\n    image: \"rabbitmq:3-management\"\n    container_name: rabbitmq\n    environment:\n      RABBITMQ_ERLANG_COOKIE: \"SWQOKODSQALRPCLNMEQG\"\n      RABBITMQ_DEFAULT_USER: \"test\"\n      RABBITMQ_DEFAULT_PASS: \"test\"\n      RABBITMQ_DEFAULT_VHOST: \"/\"\n    ports:\n    - \"15672:15672\"\n    - \"5672:5672\"\n    labels:\n      NAME: \"rabbitmq\"\n      \n  eventstore:\n    image: eventstore/eventstore:release-5.0.1\n    container_name: eventstore\n    ports:\n      - 2113:2113\n      - 1113:1113\n    restart: always\n    healthcheck:\n      test: [\"CMD-SHELL\", \"curl -sf http://localhost:2113/stats || exit 1\"]\n      interval: 5s\n      timeout: 2s\n    environment:\n      - EVENTSTORE_RUN_PROJECTIONS=all\n      - EVENTSTORE_START_STANDARD_PROJECTIONS=TRUE\n      \n  snapshot_store:\n    image: mongo:latest\n    ports:\n      - 27017:27017\n      \n  readstore:\n    image: postgres:10.6-alpine\n    container_name: readstore\n    environment:\n      - POSTGRES_DB=testdb\n      - POSTGRES_USER=dbadmin\n      - POSTGRES_PASSWORD=dbadmin\n    command:\n      - -c\n      - max_prepared_transactions=100\n    ports:\n      - \"5433:5432\"\n\n"
  }
]