Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save JefClaes/2c0063514c829181fde5 to your computer and use it in GitHub Desktop.

Select an option

Save JefClaes/2c0063514c829181fde5 to your computer and use it in GitHub Desktop.
Code snippet for reading Event Store stream in slices using F#
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