-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
441 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "2.1.504" | ||
"version": "2.1.500" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/template", | ||
"author": "@jet @bartelink", | ||
"classifications": [ | ||
"Event Sourcing", | ||
"Equinox", | ||
"Propulsion", | ||
"EventStore", | ||
"Kafka" | ||
], | ||
"tags": { | ||
"language": "F#" | ||
}, | ||
"identity": "Propulsion.Template.AllProjector", | ||
"name": "Propulsion EventStore $all Projector", | ||
"shortName": "proAllProjector", | ||
"sourceName": "ProjectorTemplate", | ||
"preferNameDirectory": true, | ||
|
||
"symbols": { | ||
"kafka": { | ||
"type": "parameter", | ||
"datatype": "bool", | ||
"isRequired": false, | ||
"defaultValue": "false", | ||
"description": "Include code projecting to Kafka." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<WarningLevel>5</WarningLevel> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="README.md" /> | ||
<Compile Include="Handler.fs" /> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Argu" Version="5.4.0" /> | ||
<PackageReference Include="Destructurama.FSharp" Version="1.1.1-dev-00033" /> | ||
<PackageReference Include="Equinox.Cosmos" Version="2.0.0-rc9" /> | ||
<PackageReference Include="Propulsion.EventStore" Version="2.0.0-rc2" /> | ||
<PackageReference Include="Propulsion.Kafka" Version="2.0.0-rc2" /> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module ProjectorTemplate.Handler | ||
|
||
open Propulsion.EventStore | ||
|
||
/// Responsible for inspecting and then either dropping or tweaking events coming from EventStore | ||
// NB the `index` needs to be contiguous with existing events - IOW filtering needs to be at stream (and not event) level | ||
let tryMapEvent filterByStreamName (x : EventStore.ClientAPI.ResolvedEvent) = | ||
match x.Event with | ||
| e when not e.IsJson || e.EventStreamId.StartsWith "$" || not (filterByStreamName e.EventStreamId) -> None | ||
| PropulsionStreamEvent e -> Some e | ||
|
||
/// Responsible for wrapping a span of events for a specific stream into an envelope (we use the well-known Propulsion.Codec form) | ||
/// Most manipulation should take place before events enter the scheduler | ||
let render (stream: FsCodec.StreamName, span: Propulsion.Streams.StreamSpan<_>) = async { | ||
let value = | ||
span | ||
|> Propulsion.Codec.NewtonsoftJson.RenderedSpan.ofStreamSpan stream | ||
|> Propulsion.Codec.NewtonsoftJson.Serdes.Serialize | ||
return FsCodec.StreamName.toString stream, value } |
Oops, something went wrong.