Skip to content

Commit 2eb0cc1

Browse files
committed
Cleanup
1 parent 6375625 commit 2eb0cc1

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

propulsion-projector/Program.fs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ module Args =
129129
| [<AltCommandLine "-u">] Username of string
130130
| [<AltCommandLine "-p">] Password of string
131131

132-
| [<CliPrefix(CliPrefix.None); Unique(*ExactlyOnce is not supported*); Last>] Es
133132
| [<CliPrefix(CliPrefix.None); Unique(*ExactlyOnce is not supported*); Last>] Cosmos of ParseResults<CosmosParameters>
133+
| [<CliPrefix(CliPrefix.None); Unique(*ExactlyOnce is not supported*); Last>] Es
134134
interface IArgParserTemplate with
135135
member a.Usage = a |> function
136136
| FromTail -> "Start the processing from the Tail"
@@ -153,8 +153,8 @@ module Args =
153153
| Retries _ -> "specify operation retries. Default: 3."
154154
| HeartbeatTimeout _ -> "specify heartbeat timeout in seconds. Default: 1.5."
155155

156-
| Es -> "Request storage of checkpoints in EventStore (not recommended due to feedback effects)."
157156
| Cosmos _ -> "CosmosDB (Checkpoint) Store parameters."
157+
| Es -> "Request storage of checkpoints in EventStore (not recommended due to feedback effects)."
158158
and EsSourceArguments(a : ParseResults<EsSourceParameters>) =
159159
let discovery (host, port, tcp) =
160160
match tcp, port with
@@ -194,10 +194,10 @@ module Args =
194194
.Connect(appName, discovery, nodePreference) |> Async.RunSynchronously
195195

196196
member __.CheckpointInterval = TimeSpan.FromHours 1.
197-
member val Checkpoints : Choice<unit, CosmosArguments> =
197+
member val Checkpoints : Choice<CosmosArguments, unit> =
198198
match a.TryGetSubCommand() with
199-
| Some (EsSourceParameters.Es) -> Choice1Of2 ()
200-
| Some (EsSourceParameters.Cosmos cosmos) -> Choice2Of2 (CosmosArguments cosmos)
199+
| Some (EsSourceParameters.Cosmos cosmos) -> Choice1Of2 (CosmosArguments cosmos)
200+
| Some (EsSourceParameters.Es) -> Choice2Of2 ()
201201
| _ -> raise (MissingArg "Must specify `cosmos` or `es` checkpoint store when source is `es`")
202202
and [<NoEquality; NoComparison>] CosmosParameters =
203203
| [<AltCommandLine "-s">] Connection of string
@@ -354,12 +354,12 @@ module Args =
354354
member __.BuildCheckpointStoreParams() =
355355
let es = __.Es
356356
match es.Checkpoints with
357-
| Choice1Of2 () ->
358-
Log.Information("Checkpointing in source EventStore ()")
359-
Choice1Of2 ()
360-
| Choice2Of2 cosmos ->
357+
| Choice1Of2 cosmos ->
361358
Log.Information("Checkpointing in Database {db} Container {container}", cosmos.Database, cosmos.Container)
362-
Choice2Of2 cosmos
359+
Choice1Of2 cosmos
360+
| Choice2Of2 () ->
361+
Log.Information("Checkpointing in source EventStore")
362+
Choice2Of2 ()
363363
//#endif
364364
#if sss
365365
member val SqlStreamStore = SqlStreamStoreSourceArguments(a.GetResult SqlMs)
@@ -461,14 +461,14 @@ let build (args : Args.Arguments) =
461461
let cache = Equinox.Cache(AppName, sizeMb=10)
462462
let checkpoints =
463463
match args.BuildCheckpointStoreParams() with
464-
| Choice1Of2 () ->
465-
let esClient = connectEs ()
466-
let context = EventStoreContext.create esClient
467-
Checkpoints.EventStore.create spec.groupName (context, cache)
468-
| Choice2Of2 cosmos ->
464+
| Choice1Of2 cosmos ->
469465
let (discovery, database, container, connector) = cosmos.BuildConnectionDetails()
470466
let context = CosmosContext.create AppName connector discovery (database, container)
471467
Checkpoints.Cosmos.create spec.groupName (context, cache)
468+
| Choice2Of2 () ->
469+
let esClient = connectEs ()
470+
let context = EventStoreContext.create esClient
471+
Checkpoints.EventStore.create spec.groupName (context, cache)
472472

473473
#if kafka // esdb && kafka
474474
let (broker, topic) = args.Target.BuildTargetParams()

0 commit comments

Comments
 (0)