Last active
August 29, 2015 14:07
-
-
Save JefClaes/2c0063514c829181fde5 to your computer and use it in GitHub Desktop.
Code snippet for reading Event Store stream in slices using F#
This file contains hidden or 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
| let rec read stream startFrom (conn : IEventStoreConnection) = | |
| seq { | |
| let size = 10000 | |
| let slice = conn.ReadStreamEventsForwardAsync(stream, startFrom, size, true).Result | |
| if (slice.IsEndOfStream) then | |
| yield slice | |
| else | |
| yield slice | |
| yield! read stream (startFrom + size) conn | |
| } | |
| let slices = read "$et-event-name" 0 conn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment