Skip to content

Commit e9c7d92

Browse files
committed
Add AllProjector
1 parent afc68d6 commit e9c7d92

File tree

6 files changed

+441
-1
lines changed

6 files changed

+441
-1
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.1.504"
3+
"version": "2.1.500"
44
}
55
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "http://json.schemastore.org/template",
3+
"author": "@jet @bartelink",
4+
"classifications": [
5+
"Event Sourcing",
6+
"Equinox",
7+
"Propulsion",
8+
"EventStore",
9+
"Kafka"
10+
],
11+
"tags": {
12+
"language": "F#"
13+
},
14+
"identity": "Propulsion.Template.AllProjector",
15+
"name": "Propulsion EventStore $all Projector",
16+
"shortName": "proAllProjector",
17+
"sourceName": "ProjectorTemplate",
18+
"preferNameDirectory": true,
19+
20+
"symbols": {
21+
"kafka": {
22+
"type": "parameter",
23+
"datatype": "bool",
24+
"isRequired": false,
25+
"defaultValue": "false",
26+
"description": "Include code projecting to Kafka."
27+
}
28+
}
29+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
6+
<WarningLevel>5</WarningLevel>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<None Include="README.md" />
11+
<Compile Include="Handler.fs" />
12+
<Compile Include="Program.fs" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Argu" Version="5.4.0" />
17+
<PackageReference Include="Destructurama.FSharp" Version="1.1.1-dev-00033" />
18+
<PackageReference Include="Equinox.Cosmos" Version="2.0.0-rc9" />
19+
<PackageReference Include="Propulsion.EventStore" Version="2.0.0-rc2" />
20+
<PackageReference Include="Propulsion.Kafka" Version="2.0.0-rc2" />
21+
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
22+
</ItemGroup>
23+
24+
</Project>

propulsion-all-projector/Handler.fs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module ProjectorTemplate.Handler
2+
3+
open Propulsion.EventStore
4+
5+
/// Responsible for inspecting and then either dropping or tweaking events coming from EventStore
6+
// NB the `index` needs to be contiguous with existing events - IOW filtering needs to be at stream (and not event) level
7+
let tryMapEvent filterByStreamName (x : EventStore.ClientAPI.ResolvedEvent) =
8+
match x.Event with
9+
| e when not e.IsJson || e.EventStreamId.StartsWith "$" || not (filterByStreamName e.EventStreamId) -> None
10+
| PropulsionStreamEvent e -> Some e
11+
12+
/// Responsible for wrapping a span of events for a specific stream into an envelope (we use the well-known Propulsion.Codec form)
13+
/// Most manipulation should take place before events enter the scheduler
14+
let render (stream: FsCodec.StreamName, span: Propulsion.Streams.StreamSpan<_>) = async {
15+
let value =
16+
span
17+
|> Propulsion.Codec.NewtonsoftJson.RenderedSpan.ofStreamSpan stream
18+
|> Propulsion.Codec.NewtonsoftJson.Serdes.Serialize
19+
return FsCodec.StreamName.toString stream, value }

0 commit comments

Comments
 (0)