Created
April 12, 2022 08:54
-
-
Save marcingolenia/28036753c5c8a96edcfe87cbc2d6d4c8 to your computer and use it in GitHub Desktop.
Connect to secure eventstoredb in 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
open System | |
open System.Text | |
open EventStore.Client | |
open Xunit | |
[<Fact>] | |
let ``Connect to event store`` () = | |
// Arrange | |
let data: string = "{ \"a\":\"2\"}" | |
let metadata: string = "{}" | |
use connection = new EventStoreClient(EventStoreClientSettings.Create "esdb://eventstore1.northeurope.cloudapp.azure.com:2113?tls=true") | |
let events: System.Collections.Generic.IEnumerable<EventData> = [ EventData( | |
Uuid.NewUuid(), | |
"typoszcze", | |
data |> Encoding.UTF8.GetBytes |> ReadOnlyMemory<byte>, | |
metadata |> Encoding.UTF8.GetBytes |> ReadOnlyMemory<byte>) ] | |
connection.AppendToStreamAsync("baba", StreamRevision.FromInt64 0 , events) |> Async.AwaitTask |> Async.RunSynchronously |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment