File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 33open System.Threading
44open SqlStreamStore
55open SqlStreamStore.Streams
6+ open Insurello.AsyncExtra
67
78type ReadingDirection =
89 | Forward
@@ -34,3 +35,17 @@ module ReadExtras =
3435 if messageList.Length = msgCount
3536 then Ok messageList
3637 else Error( sprintf " Failed to retrieve all messages. Messages retrieved count: %d " messageList.Length)
38+
39+ let readStreamMessages ' : IStreamStore -> ReadingDirection -> StreamDetails -> int -> AsyncResult < List < StreamMessage >, string > =
40+ fun store direction stream msgCount ->
41+ Read.readFromStreamAsync store direction stream msgCount
42+ |> Async.bind ( fun readStreamPage ->
43+ readStreamPage.Messages
44+ |> Seq.toList
45+ |> fun messageList ->
46+ if messageList.Length = msgCount then
47+ Ok messageList
48+ else
49+ Error
50+ ( sprintf " Failed to retrieve all messages. Messages retrieved count: %d " messageList.Length)
51+ |> AsyncResult.fromResult)
Original file line number Diff line number Diff line change 1212 </ItemGroup >
1313
1414 <ItemGroup >
15+ <PackageReference Include =" Insurello.AsyncExtra" Version =" 1.1.0" />
1516 <PackageReference Include =" SqlStreamStore" Version =" 1.2.0-beta.8" />
1617 <PackageReference Include =" SqlStreamStore.Postgres" Version =" 1.2.0-beta.8" />
1718 </ItemGroup >
You can’t perform that action at this time.
0 commit comments