Skip to content

Commit

Permalink
AllProjector --noEventStore cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 23, 2020
1 parent e5ecd12 commit 1d9f55d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ This repo hosts the source for Jet's [`dotnet new`](https://docs.microsoft.com/e

Standard processing shows importing (in summary form) from an aggregate in `EventStore` or `Cosmos` to a Summary form in `Cosmos` (use `-b`(`lank`) to remove, yielding a minimal projector)

`-k` adds Optional projection to Apache Kafka using [`Propulsion.Kafka`](https://github.com/jet/propulsion) (instead of ingesting into a local `Cosmos` store).
`-noEventStore` removes support for projecting from EventStore from the emitted code
`--kafka` adds Optional projection to Apache Kafka using [`Propulsion.Kafka`](https://github.com/jet/propulsion) (instead of ingesting into a local `Cosmos` store).
`--noEventStore` removes support for projecting from EventStore from the emitted code

- [`proSync`](propulsion-sync/README.md) - Boilerplate for a console app that that syncs events between [`Equinox.Cosmos` and `Equinox.EventStore` stores](https://github.com/jet/equinox) using the [relevant `Propulsion`.* libraries](https://github.com/jet/propulsion), filtering/enriching/mapping Events as necessary.

Expand Down
6 changes: 6 additions & 0 deletions propulsion-all-projector/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
"exclude": [
"Ingester.fs"
]
},
{
"condition": "noEventStore && !kafka",
"exclude": [
"Handler.fs"
]
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions propulsion-all-projector/AllProjector.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<!--#if (!kafka) -->
<Compile Include="Ingester.fs" />
<!--#endif-->
<!--#if (!noEventStore || kafka) -->
<Compile Include="Handler.fs" />
<!--#endif-->
<Compile Include="Program.fs" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion propulsion-all-projector/Handler.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AllTemplate.Handler

//#if (!noEventStore)

open Propulsion.EventStore

/// Responsible for inspecting and then either dropping or tweaking events coming from EventStore
Expand Down
11 changes: 10 additions & 1 deletion propulsion-all-projector/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,16 @@ module Logging =
.Destructure.FSharpTypes()
.Enrich.FromLogContext()
|> fun c -> if verbose then c.MinimumLevel.Debug() else c
|> fun c -> let t = "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}"
// LibLog writes to the global logger, so we need to control the emission
|> fun c -> let cfpl = if changeLogVerbose then Serilog.Events.LogEventLevel.Debug else Serilog.Events.LogEventLevel.Warning
c.MinimumLevel.Override("Microsoft.Azure.Documents.ChangeFeedProcessor", cfpl)
|> fun c -> let isCfp429a = Filters.Matching.FromSource("Microsoft.Azure.Documents.ChangeFeedProcessor.LeaseManagement.DocumentServiceLeaseUpdater").Invoke
let isCfp429b = Filters.Matching.FromSource("Microsoft.Azure.Documents.ChangeFeedProcessor.PartitionManagement.LeaseRenewer").Invoke
let isCfp429c = Filters.Matching.FromSource("Microsoft.Azure.Documents.ChangeFeedProcessor.PartitionManagement.PartitionLoadBalancer").Invoke
let isCfp429d = Filters.Matching.FromSource("Microsoft.Azure.Documents.ChangeFeedProcessor.FeedProcessing.PartitionProcessor").Invoke
let isCfp x = isCfp429a x || isCfp429b x || isCfp429c x || isCfp429d x
if changeLogVerbose then c else c.Filter.ByExcluding(fun x -> isCfp x)
|> fun c -> let t = "[{Timestamp:HH:mm:ss} {Level:u3}] {partitionKeyRangeId,2} {Message:lj} {NewLine}{Exception}"
c.WriteTo.Console(theme=Sinks.SystemConsole.Themes.AnsiConsoleTheme.Code, outputTemplate=t)
|> fun c -> c.CreateLogger()

Expand Down
6 changes: 3 additions & 3 deletions propulsion-all-projector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ This project was generated using:
//#if kafka

dotnet new -i Equinox.Templates # just once, to install/update in the local templates store
dotnet new proAllProjector -noEventStore -k # -k => include Kafka projection logic
dotnet new proAllProjector --noEventStore -k # -k => include Kafka projection logic
//#else

dotnet new -i Equinox.Templates # just once, to install/update in the local templates store
# add -k to add Kafka Projection logic
dotnet new proAllProjector -noEventStore # use --help to see options
dotnet new proAllProjector --noEventStore # use --help to see options
//#endif
//#else
//#if kafka
Expand Down Expand Up @@ -63,8 +63,8 @@ This project was generated using:
NOTE when projecting from EventStore, the current implementation stores the checkpoints within the CosmosDB store in order to remove feedback effects.

(Yes, someone should do a PR to store the checkpoints in EventStore itself; this is extracted from working code, which can assume there's always a CosmosDB around)
//#endif

//#endif
3. To run an instance of the Projector from a CosmosDb ChangeFeed

//#if kafka
Expand Down

0 comments on commit 1d9f55d

Please sign in to comment.