diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml
index 752de25fb..4023569e8 100644
--- a/.github/workflows/base.yml
+++ b/.github/workflows/base.yml
@@ -22,10 +22,10 @@ on:
jobs:
test:
timeout-minutes: 20
- strategy:
+ strategy:
fail-fast: false
matrix:
- framework: [ net6.0, net7.0, net8.0 ]
+ framework: [ net8.0, net9.0 ]
os: [ ubuntu-latest ]
configuration: [ release ]
runs-on: ${{ matrix.os }}
@@ -33,36 +33,36 @@ jobs:
env:
CLOUDSMITH_CICD_USER: ${{ secrets.CLOUDSMITH_CICD_USER }}
steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- - name: Login to Cloudsmith
- if: ${{ env.CLOUDSMITH_CICD_USER != '' }}
- uses: docker/login-action@v3
- with:
- registry: docker.eventstore.com
- username: ${{ secrets.CLOUDSMITH_CICD_USER }}
- password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }}
- - name: Pull EventStore Image
- shell: bash
- run: |
- docker pull docker.eventstore.com/${{ inputs.docker-image }}:${{ inputs.docker-tag }}
- - name: Install dotnet SDKs
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 6.0.x
- 7.0.x
- 8.0.x
- - name: Run Tests
- shell: bash
- env:
- ES_DOCKER_TAG: ${{ inputs.docker-tag }}
- ES_DOCKER_REGISTRY: docker.eventstore.com/${{ inputs.docker-image }}
- run: |
- sudo ./gencert.sh
- dotnet test --configuration ${{ matrix.configuration }} --blame \
- --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \
- --framework ${{ matrix.framework }} \
- test/EventStore.Client.${{ inputs.test }}.Tests
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Login to Cloudsmith
+ if: ${{ env.CLOUDSMITH_CICD_USER != '' }}
+ uses: docker/login-action@v3
+ with:
+ registry: docker.eventstore.com
+ username: ${{ secrets.CLOUDSMITH_CICD_USER }}
+ password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }}
+ - name: Pull EventStore Image
+ shell: bash
+ run: |
+ docker pull docker.eventstore.com/${{ inputs.docker-image }}:${{ inputs.docker-tag }}
+ - name: Install dotnet SDKs
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+ - name: Run Tests
+ shell: bash
+ env:
+ ES_DOCKER_TAG: ${{ inputs.docker-tag }}
+ ES_DOCKER_REGISTRY: docker.eventstore.com/${{ inputs.docker-image }}
+ run: |
+ sudo ./gencert.sh
+ dotnet test --configuration ${{ matrix.configuration }} --blame \
+ --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \
+ --framework ${{ matrix.framework }} \
+ --filter "Category=Target:${{ inputs.test }}" \
+ test/Kurrent.Client.Tests
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4b8e1f9b1..ec0af3697 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
docker-tag: [ ci, lts, previous-lts ]
- test: [ Streams, PersistentSubscriptions, Operations, UserManagement, ProjectionManagement ]
+ test: [ Streams, PersistentSubscriptions, Operations, ProjectionManagement, UserManagement, Security, Misc ]
name: Test CE (${{ matrix.docker-tag }})
with:
docker-tag: ${{ matrix.docker-tag }}
diff --git a/.github/workflows/dispatch-ce.yml b/.github/workflows/dispatch-ce.yml
index 722baaea7..c05c2402f 100644
--- a/.github/workflows/dispatch-ce.yml
+++ b/.github/workflows/dispatch-ce.yml
@@ -15,10 +15,10 @@ on:
jobs:
test:
uses: ./.github/workflows/base.yml
- strategy:
+ strategy:
fail-fast: false
matrix:
- test: [ Streams, PersistentSubscriptions, Operations, UserManagement, ProjectionManagement ]
+ test: [ Streams, PersistentSubscriptions, Operations, ProjectionManagement, UserManagement, Security, Misc ]
name: Test CE (${{ inputs.docker-tag }})
with:
docker-tag: ${{ inputs.docker-tag }}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 598be309d..ef6dfb6bc 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,199 +1,201 @@
-name: Publish
-
-on:
- pull_request:
- push:
- branches:
- - master
- tags:
- - v*
-
-jobs:
- vulnerability-scan:
- timeout-minutes: 10
- strategy:
- fail-fast: false
- matrix:
- framework: [ net6.0, net7.0, net8.0 ]
- os: [ ubuntu-latest, windows-latest ]
- runs-on: ${{ matrix.os }}
- name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }}
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Install dotnet SDKs
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 6.0.x
- 7.0.x
- 8.0.x
- - name: Scan for Vulnerabilities
- shell: bash
- run: |
- dotnet nuget list source
- dotnet restore
- dotnet list package --vulnerable --include-transitive --framework ${{ matrix.framework }} | tee vulnerabilities.txt
- ! cat vulnerabilities.txt | grep -q "has the following vulnerable packages"
-
- build-samples:
- timeout-minutes: 5
- name: build-samples/${{ matrix.framework }}
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- framework: [ net8.0 ]
- services:
- esdb:
- image: docker.eventstore.com/eventstore-ce/eventstoredb-ce:lts
- env:
- EVENTSTORE_INSECURE: true
- EVENTSTORE_MEM_DB: false
- EVENTSTORE_RUN_PROJECTIONS: all
- EVENTSTORE_START_STANDARD_PROJECTIONS: true
- ports:
- - 2113:2113
- options: --health-cmd "exit 0"
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Install dotnet SDKs
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 8.0.x
- - name: Compile
- shell: bash
- run: |
- dotnet build samples
- - name: Run
- shell: bash
- run: |
- find samples/ -type f -iname "*.csproj" -print0 | xargs -0L1 dotnet run --framework ${{ matrix.framework }} --project
-
- generate-certificates:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Generate certificates
- run: |
- mkdir -p certs
- docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-ca -out /tmp/ca
- docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-node -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/node -ip-addresses 127.0.0.1 -dns-names localhost
- docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-user -username admin -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-admin
- docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-user -username invalid -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-invalid
- - name: Set permissions on certificates
- run: |
- sudo chown -R $USER:$USER certs
- sudo chmod -R 755 certs
- - name: Upload certificates
- uses: actions/upload-artifact@v4
- with:
- name: certs
- path: certs
-
- test:
- needs: generate-certificates
- timeout-minutes: 20
- strategy:
- fail-fast: false
- matrix:
- framework: [ net6.0, net7.0, net8.0 ]
- os: [ ubuntu-latest, windows-latest ]
- configuration: [ release ]
- runs-on: ${{ matrix.os }}
- name: test/EventStore.Client/${{ matrix.os }}/${{ matrix.framework }}
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - shell: bash
- run: |
- git fetch --prune --unshallow
- - name: Install dotnet SDKs
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 6.0.x
- 7.0.x
- 8.0.x
- - name: Compile
- shell: bash
- run: |
- dotnet build --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} src/EventStore.Client
- - name: Download certificates
- uses: actions/download-artifact@v4
- with:
- name: certs
- path: certs
- - name: Run Tests (Linux)
- if: runner.os == 'Linux'
- shell: bash
- run: |
- dotnet test --configuration ${{ matrix.configuration }} --blame \
- --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \
- --framework ${{ matrix.framework }} \
- test/EventStore.Client.Tests
- - name: Run Tests (Windows)
- if: runner.os == 'Windows'
- shell: pwsh
- run: |
- dotnet test --configuration ${{ matrix.configuration }} --blame `
- --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" `
- --framework ${{ matrix.framework }} `
- test/EventStore.Client.Tests
-
- publish:
- timeout-minutes: 5
- needs: [ vulnerability-scan, test, build-samples ]
- runs-on: ubuntu-latest
- name: publish
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Get Version
- id: get_version
- run: |
- echo "branch=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- dotnet nuget list source
- dotnet tool restore
- version=$(dotnet tool run minver -- --tag-prefix=v)
- echo "version=${version}" >> $GITHUB_OUTPUT
- - shell: bash
- run: |
- git fetch --prune --unshallow
- - name: Install dotnet SDKs
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 6.0.x
- 7.0.x
- 8.0.x
- - name: Dotnet Pack
- shell: bash
- run: |
- mkdir -p packages
- dotnet pack /p:Version=${{ steps.get_version.outputs.version }} --configuration=Release \
- /p:PublishDir=./packages \
- /p:NoWarn=NU5105 \
- /p:RepositoryUrl=https://github.com/EventStore/EventStore-Client-Dotnet \
- /p:RepositoryType=git
- - name: Publish Artifacts
- uses: actions/upload-artifact@v4
- with:
- path: packages
- name: nuget-packages
- - name: Dotnet Push to Github Packages
- shell: bash
- if: github.event_name == 'push'
- run: |
- dotnet tool restore
- find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.github_token }} --source https://nuget.pkg.github.com/EventStore/index.json --skip-duplicate
- - name: Dotnet Push to Nuget.org
- shell: bash
- if: contains(steps.get_version.outputs.branch, 'v')
- run: |
- dotnet nuget list source
- dotnet tool restore
- find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.nuget_key }} --source https://api.nuget.org/v3/index.json --skip-duplicate
+#name: Publish
+#
+#on:
+# pull_request:
+# push:
+# branches:
+# - master
+# tags:
+# - v*
+#
+#jobs:
+# vulnerability-scan:
+# timeout-minutes: 10
+# strategy:
+# fail-fast: false
+# matrix:
+# framework: [ net8.0, net9.0 ]
+# os: [ ubuntu-latest, windows-latest ]
+# runs-on: ${{ matrix.os }}
+# name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }}
+# steps:
+# - name: Checkout
+# uses: actions/checkout@v3
+# - name: Install dotnet SDKs
+# uses: actions/setup-dotnet@v3
+# with:
+# dotnet-version: |
+# 8.0.x
+# 9.0.x
+# - name: Scan for Vulnerabilities
+# shell: bash
+# run: |
+# dotnet nuget list source
+# dotnet restore ./src/Kurrent.Client/Kurrent.Client.csproj
+# dotnet restore ./test/Kurrent.Client.Tests/Kurrent.Client.Tests.csproj
+# dotnet list package --vulnerable --include-transitive --framework ${{ matrix.framework }} | tee vulnerabilities.txt
+# ! cat vulnerabilities.txt | grep -q "has the following vulnerable packages"
+#
+# build-samples:
+# timeout-minutes: 5
+# name: build-samples/${{ matrix.framework }}
+# runs-on: ubuntu-latest
+# strategy:
+# fail-fast: false
+# matrix:
+# framework: [ net8.0, net9.0 ]
+# services:
+# esdb:
+# image: docker.eventstore.com/eventstore-ce/eventstoredb-ce:lts
+# env:
+# EVENTSTORE_INSECURE: true
+# EVENTSTORE_MEM_DB: false
+# EVENTSTORE_RUN_PROJECTIONS: all
+# EVENTSTORE_START_STANDARD_PROJECTIONS: true
+# ports:
+# - 2113:2113
+# options: --health-cmd "exit 0"
+# steps:
+# - name: Checkout
+# uses: actions/checkout@v3
+# - name: Install dotnet SDKs
+# uses: actions/setup-dotnet@v3
+# with:
+# dotnet-version: |
+# 8.0.x
+# 9.0.x
+# - name: Compile
+# shell: bash
+# run: |
+# dotnet build samples
+# - name: Run
+# shell: bash
+# run: |
+# find samples/ -type f -iname "*.csproj" -print0 | xargs -0L1 dotnet run --framework ${{ matrix.framework }} --project
+#
+# generate-certificates:
+# runs-on: ubuntu-latest
+# steps:
+# - name: Checkout code
+# uses: actions/checkout@v4
+# - name: Generate certificates
+# run: |
+# mkdir -p certs
+# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-ca -out /tmp/ca
+# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-node -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/node -ip-addresses 127.0.0.1 -dns-names localhost
+# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-user -username admin -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-admin
+# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.eventstore.com/eventstore-utils/es-gencert-cli:latest create-user -username invalid -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-invalid
+# - name: Set permissions on certificates
+# run: |
+# sudo chown -R $USER:$USER certs
+# sudo chmod -R 755 certs
+# - name: Upload certificates
+# uses: actions/upload-artifact@v4
+# with:
+# name: certs
+# path: certs
+#
+# test:
+# needs: generate-certificates
+# timeout-minutes: 10
+# strategy:
+# fail-fast: false
+# matrix:
+# framework: [ net8.0, net9.0 ]
+# os: [ ubuntu-latest, windows-latest ]
+# configuration: [ release ]
+# test: [ Streams, PersistentSubscriptions, Operations, ProjectionManagement, UserManagement, Security, Misc ]
+# runs-on: ${{ matrix.os }}
+# name: ${{ matrix.test }} (${{ matrix.os }}, ${{ matrix.framework }})
+# steps:
+# - name: Checkout
+# uses: actions/checkout@v3
+# - shell: bash
+# run: |
+# git fetch --prune --unshallow
+# - name: Install dotnet SDKs
+# uses: actions/setup-dotnet@v3
+# with:
+# dotnet-version: |
+# 8.0.x
+# 9.0.x
+# - name: Compile
+# shell: bash
+# run: |
+# dotnet build --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} src/Kurrent.Client
+# - name: Download certificates
+# uses: actions/download-artifact@v4
+# with:
+# name: certs
+# path: certs
+# - name: Run Tests (Linux)
+# if: runner.os == 'Linux'
+# shell: bash
+# run: |
+# dotnet test --configuration ${{ matrix.configuration }} --blame \
+# --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \
+# --framework ${{ matrix.framework }} \
+# --filter "Category=Target:${{ matrix.test }}" \
+# test/Kurrent.Client.Tests
+# - name: Run Tests (Windows)
+# if: runner.os == 'Windows'
+# shell: pwsh
+# run: |
+# dotnet test --configuration ${{ matrix.configuration }} --blame `
+# --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" `
+# --framework ${{ matrix.framework }} `
+# --filter "Category=Target:${{ matrix.test }}" `
+# test/Kurrent.Client.Tests
+#
+# publish:
+# timeout-minutes: 5
+# needs: [ vulnerability-scan, test, build-samples ]
+# runs-on: ubuntu-latest
+# name: publish
+# steps:
+# - name: Checkout
+# uses: actions/checkout@v3
+# - name: Get Version
+# id: get_version
+# run: |
+# echo "branch=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
+# dotnet nuget list source
+# dotnet tool restore
+# version=$(dotnet tool run minver -- --tag-prefix=v)
+# echo "version=${version}" >> $GITHUB_OUTPUT
+# - shell: bash
+# run: |
+# git fetch --prune --unshallow
+# - name: Install dotnet SDKs
+# uses: actions/setup-dotnet@v3
+# with:
+# dotnet-version: |
+# 8.0.x
+# 9.0.x
+# - name: Dotnet Pack
+# shell: bash
+# run: |
+# mkdir -p packages
+# dotnet pack /p:Version=${{ steps.get_version.outputs.version }} --configuration=Release \
+# /p:PublishDir=./packages \
+# /p:NoWarn=NU5105 \
+# /p:RepositoryUrl=https://github.com/EventStore/EventStore-Client-Dotnet \
+# /p:RepositoryType=git
+# - name: Publish Artifacts
+# uses: actions/upload-artifact@v4
+# with:
+# path: packages
+# name: nuget-packages
+# - name: Dotnet Push to Github Packages
+# shell: bash
+# if: github.event_name == 'push'
+# run: |
+# dotnet tool restore
+# find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.github_token }} --source https://nuget.pkg.github.com/EventStore/index.json --skip-duplicate
+# - name: Dotnet Push to Nuget.org
+# shell: bash
+# if: contains(steps.get_version.outputs.branch, 'v')
+# run: |
+# dotnet nuget list source
+# dotnet tool restore
+# find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.nuget_key }} --source https://api.nuget.org/v3/index.json --skip-duplicate
diff --git a/Directory.Build.props b/Directory.Build.props
index dd2dd9339..a22d9632a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,11 +1,10 @@
- net48;net6.0;net7.0;net8.0
+ net48;net8.0;net9.0
true
enable
enable
true
- true
preview
Debug
@@ -13,8 +12,6 @@
pdbonly
true
- 2.60.0
- 2.60.0
diff --git a/EventStore.Client.sln b/EventStore.Client.sln
deleted file mode 100644
index 72ec92f54..000000000
--- a/EventStore.Client.sln
+++ /dev/null
@@ -1,127 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26124.0
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.UserManagement", "src\EventStore.Client.UserManagement\EventStore.Client.UserManagement.csproj", "{D3744A86-DD35-4104-AAEE-84B79062C4A2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Streams", "src\EventStore.Client.Streams\EventStore.Client.Streams.csproj", "{362C0CF9-81C9-400F-94C7-A8B190ECE94A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Operations", "src\EventStore.Client.Operations\EventStore.Client.Operations.csproj", "{6EFB980F-C72C-40F1-9232-479BE5617580}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.ProjectionManagement", "src\EventStore.Client.ProjectionManagement\EventStore.Client.ProjectionManagement.csproj", "{B275EF4B-80D3-4205-9C7A-337A2A2BD99C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.PersistentSubscriptions", "src\EventStore.Client.PersistentSubscriptions\EventStore.Client.PersistentSubscriptions.csproj", "{66FDEE78-836E-49F0-A4DD-BF7539C34E54}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client", "src\EventStore.Client\EventStore.Client.csproj", "{8853D875-4A8E-450B-A1BE-9CEF8BEDABC3}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C51F2C69-45A9-4D0D-A708-4FC319D5D340}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.ProjectionManagement.Tests", "test\EventStore.Client.ProjectionManagement.Tests\EventStore.Client.ProjectionManagement.Tests.csproj", "{8F8548D6-694C-4BAE-9EF3-A020140E04C7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Operations.Tests", "test\EventStore.Client.Operations.Tests\EventStore.Client.Operations.Tests.csproj", "{4BA2E05E-6B45-47C3-9001-8B039244ECA9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Streams.Tests", "test\EventStore.Client.Streams.Tests\EventStore.Client.Streams.Tests.csproj", "{082C77F5-4FF5-41D4-A1F1-710F05956E1C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Tests", "test\EventStore.Client.Tests\EventStore.Client.Tests.csproj", "{FC829F1B-43AD-4C96-9002-23D04BBA3AF3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.PersistentSubscriptions.Tests", "test\EventStore.Client.PersistentSubscriptions.Tests\EventStore.Client.PersistentSubscriptions.Tests.csproj", "{6CEB731F-72E1-461F-A6B3-54DBF3FD786C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.UserManagement.Tests", "test\EventStore.Client.UserManagement.Tests\EventStore.Client.UserManagement.Tests.csproj", "{22634CEE-4F7B-4679-A48D-38A2A8580ECA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Tests.Common", "test\EventStore.Client.Tests.Common\EventStore.Client.Tests.Common.csproj", "{E326832D-DE52-4DE4-9E54-C800908B75F3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Extensions.OpenTelemetry", "src\EventStore.Client.Extensions.OpenTelemetry\EventStore.Client.Extensions.OpenTelemetry.csproj", "{3723933C-585A-49BE-98E8-52D3FAD904CE}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Plugins.Tests", "test\EventStore.Client.Plugins.Tests\EventStore.Client.Plugins.Tests.csproj", "{7D929D45-F1D9-462B-BE49-84BEC11D5039}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D3744A86-DD35-4104-AAEE-84B79062C4A2}.Debug|x64.ActiveCfg = Debug|Any CPU
- {D3744A86-DD35-4104-AAEE-84B79062C4A2}.Debug|x64.Build.0 = Debug|Any CPU
- {D3744A86-DD35-4104-AAEE-84B79062C4A2}.Release|x64.ActiveCfg = Release|Any CPU
- {D3744A86-DD35-4104-AAEE-84B79062C4A2}.Release|x64.Build.0 = Release|Any CPU
- {362C0CF9-81C9-400F-94C7-A8B190ECE94A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {362C0CF9-81C9-400F-94C7-A8B190ECE94A}.Debug|x64.Build.0 = Debug|Any CPU
- {362C0CF9-81C9-400F-94C7-A8B190ECE94A}.Release|x64.ActiveCfg = Release|Any CPU
- {362C0CF9-81C9-400F-94C7-A8B190ECE94A}.Release|x64.Build.0 = Release|Any CPU
- {6EFB980F-C72C-40F1-9232-479BE5617580}.Debug|x64.ActiveCfg = Debug|Any CPU
- {6EFB980F-C72C-40F1-9232-479BE5617580}.Debug|x64.Build.0 = Debug|Any CPU
- {6EFB980F-C72C-40F1-9232-479BE5617580}.Release|x64.ActiveCfg = Release|Any CPU
- {6EFB980F-C72C-40F1-9232-479BE5617580}.Release|x64.Build.0 = Release|Any CPU
- {B275EF4B-80D3-4205-9C7A-337A2A2BD99C}.Debug|x64.ActiveCfg = Debug|Any CPU
- {B275EF4B-80D3-4205-9C7A-337A2A2BD99C}.Debug|x64.Build.0 = Debug|Any CPU
- {B275EF4B-80D3-4205-9C7A-337A2A2BD99C}.Release|x64.ActiveCfg = Release|Any CPU
- {B275EF4B-80D3-4205-9C7A-337A2A2BD99C}.Release|x64.Build.0 = Release|Any CPU
- {66FDEE78-836E-49F0-A4DD-BF7539C34E54}.Debug|x64.ActiveCfg = Debug|Any CPU
- {66FDEE78-836E-49F0-A4DD-BF7539C34E54}.Debug|x64.Build.0 = Debug|Any CPU
- {66FDEE78-836E-49F0-A4DD-BF7539C34E54}.Release|x64.ActiveCfg = Release|Any CPU
- {66FDEE78-836E-49F0-A4DD-BF7539C34E54}.Release|x64.Build.0 = Release|Any CPU
- {8853D875-4A8E-450B-A1BE-9CEF8BEDABC3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {8853D875-4A8E-450B-A1BE-9CEF8BEDABC3}.Debug|x64.Build.0 = Debug|Any CPU
- {8853D875-4A8E-450B-A1BE-9CEF8BEDABC3}.Release|x64.ActiveCfg = Release|Any CPU
- {8853D875-4A8E-450B-A1BE-9CEF8BEDABC3}.Release|x64.Build.0 = Release|Any CPU
- {8F8548D6-694C-4BAE-9EF3-A020140E04C7}.Debug|x64.ActiveCfg = Debug|Any CPU
- {8F8548D6-694C-4BAE-9EF3-A020140E04C7}.Debug|x64.Build.0 = Debug|Any CPU
- {8F8548D6-694C-4BAE-9EF3-A020140E04C7}.Release|x64.ActiveCfg = Release|Any CPU
- {8F8548D6-694C-4BAE-9EF3-A020140E04C7}.Release|x64.Build.0 = Release|Any CPU
- {4BA2E05E-6B45-47C3-9001-8B039244ECA9}.Debug|x64.ActiveCfg = Debug|Any CPU
- {4BA2E05E-6B45-47C3-9001-8B039244ECA9}.Debug|x64.Build.0 = Debug|Any CPU
- {4BA2E05E-6B45-47C3-9001-8B039244ECA9}.Release|x64.ActiveCfg = Release|Any CPU
- {4BA2E05E-6B45-47C3-9001-8B039244ECA9}.Release|x64.Build.0 = Release|Any CPU
- {082C77F5-4FF5-41D4-A1F1-710F05956E1C}.Debug|x64.ActiveCfg = Debug|Any CPU
- {082C77F5-4FF5-41D4-A1F1-710F05956E1C}.Debug|x64.Build.0 = Debug|Any CPU
- {082C77F5-4FF5-41D4-A1F1-710F05956E1C}.Release|x64.ActiveCfg = Release|Any CPU
- {082C77F5-4FF5-41D4-A1F1-710F05956E1C}.Release|x64.Build.0 = Release|Any CPU
- {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Debug|x64.Build.0 = Debug|Any CPU
- {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Release|x64.ActiveCfg = Release|Any CPU
- {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Release|x64.Build.0 = Release|Any CPU
- {6CEB731F-72E1-461F-A6B3-54DBF3FD786C}.Debug|x64.ActiveCfg = Debug|Any CPU
- {6CEB731F-72E1-461F-A6B3-54DBF3FD786C}.Debug|x64.Build.0 = Debug|Any CPU
- {6CEB731F-72E1-461F-A6B3-54DBF3FD786C}.Release|x64.ActiveCfg = Release|Any CPU
- {6CEB731F-72E1-461F-A6B3-54DBF3FD786C}.Release|x64.Build.0 = Release|Any CPU
- {22634CEE-4F7B-4679-A48D-38A2A8580ECA}.Debug|x64.ActiveCfg = Debug|Any CPU
- {22634CEE-4F7B-4679-A48D-38A2A8580ECA}.Debug|x64.Build.0 = Debug|Any CPU
- {22634CEE-4F7B-4679-A48D-38A2A8580ECA}.Release|x64.ActiveCfg = Release|Any CPU
- {22634CEE-4F7B-4679-A48D-38A2A8580ECA}.Release|x64.Build.0 = Release|Any CPU
- {E326832D-DE52-4DE4-9E54-C800908B75F3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {E326832D-DE52-4DE4-9E54-C800908B75F3}.Debug|x64.Build.0 = Debug|Any CPU
- {E326832D-DE52-4DE4-9E54-C800908B75F3}.Release|x64.ActiveCfg = Release|Any CPU
- {E326832D-DE52-4DE4-9E54-C800908B75F3}.Release|x64.Build.0 = Release|Any CPU
- {3723933C-585A-49BE-98E8-52D3FAD904CE}.Debug|x64.ActiveCfg = Debug|Any CPU
- {3723933C-585A-49BE-98E8-52D3FAD904CE}.Debug|x64.Build.0 = Debug|Any CPU
- {3723933C-585A-49BE-98E8-52D3FAD904CE}.Release|x64.ActiveCfg = Release|Any CPU
- {3723933C-585A-49BE-98E8-52D3FAD904CE}.Release|x64.Build.0 = Release|Any CPU
- {7D929D45-F1D9-462B-BE49-84BEC11D5039}.Debug|x64.ActiveCfg = Debug|Any CPU
- {7D929D45-F1D9-462B-BE49-84BEC11D5039}.Debug|x64.Build.0 = Debug|Any CPU
- {7D929D45-F1D9-462B-BE49-84BEC11D5039}.Release|x64.ActiveCfg = Release|Any CPU
- {7D929D45-F1D9-462B-BE49-84BEC11D5039}.Release|x64.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {D3744A86-DD35-4104-AAEE-84B79062C4A2} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {362C0CF9-81C9-400F-94C7-A8B190ECE94A} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {6EFB980F-C72C-40F1-9232-479BE5617580} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {B275EF4B-80D3-4205-9C7A-337A2A2BD99C} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {66FDEE78-836E-49F0-A4DD-BF7539C34E54} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {8853D875-4A8E-450B-A1BE-9CEF8BEDABC3} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {8F8548D6-694C-4BAE-9EF3-A020140E04C7} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {4BA2E05E-6B45-47C3-9001-8B039244ECA9} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {082C77F5-4FF5-41D4-A1F1-710F05956E1C} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {FC829F1B-43AD-4C96-9002-23D04BBA3AF3} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {6CEB731F-72E1-461F-A6B3-54DBF3FD786C} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {22634CEE-4F7B-4679-A48D-38A2A8580ECA} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {E326832D-DE52-4DE4-9E54-C800908B75F3} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- {3723933C-585A-49BE-98E8-52D3FAD904CE} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
- {7D929D45-F1D9-462B-BE49-84BEC11D5039} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
- EndGlobalSection
-EndGlobal
diff --git a/Kurrent.Client.sln b/Kurrent.Client.sln
new file mode 100644
index 000000000..1ea14ce6f
--- /dev/null
+++ b/Kurrent.Client.sln
@@ -0,0 +1,57 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C51F2C69-45A9-4D0D-A708-4FC319D5D340}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests", "test\Kurrent.Client.Tests\Kurrent.Client.Tests.csproj", "{FC829F1B-43AD-4C96-9002-23D04BBA3AF3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client", "src\Kurrent.Client\Kurrent.Client.csproj", "{762EECAA-122E-4B0C-BC50-5AA4F72CA4E0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.Common", "test\Kurrent.Client.Tests.Common\Kurrent.Client.Tests.Common.csproj", "{47BF715B-A0BF-4044-B335-717E56422550}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.NeverLoadedAssembly", "test\Kurrent.Client.Tests.NeverLoadedAssembly\Kurrent.Client.Tests.NeverLoadedAssembly.csproj", "{0AC8A7E9-6839-4B4C-B299-950C376DF71F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.ExternalAssembly", "test\Kurrent.Client.Tests.ExternalAssembly\Kurrent.Client.Tests.ExternalAssembly.csproj", "{829AF806-1144-408A-85FE-763835775086}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Debug|x64.Build.0 = Debug|Any CPU
+ {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Release|x64.ActiveCfg = Release|Any CPU
+ {FC829F1B-43AD-4C96-9002-23D04BBA3AF3}.Release|x64.Build.0 = Release|Any CPU
+ {762EECAA-122E-4B0C-BC50-5AA4F72CA4E0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {762EECAA-122E-4B0C-BC50-5AA4F72CA4E0}.Debug|x64.Build.0 = Debug|Any CPU
+ {762EECAA-122E-4B0C-BC50-5AA4F72CA4E0}.Release|x64.ActiveCfg = Release|Any CPU
+ {762EECAA-122E-4B0C-BC50-5AA4F72CA4E0}.Release|x64.Build.0 = Release|Any CPU
+ {47BF715B-A0BF-4044-B335-717E56422550}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {47BF715B-A0BF-4044-B335-717E56422550}.Debug|x64.Build.0 = Debug|Any CPU
+ {47BF715B-A0BF-4044-B335-717E56422550}.Release|x64.ActiveCfg = Release|Any CPU
+ {47BF715B-A0BF-4044-B335-717E56422550}.Release|x64.Build.0 = Release|Any CPU
+ {0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Debug|x64.Build.0 = Debug|Any CPU
+ {0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Release|x64.ActiveCfg = Release|Any CPU
+ {0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Release|x64.Build.0 = Release|Any CPU
+ {829AF806-1144-408A-85FE-763835775086}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {829AF806-1144-408A-85FE-763835775086}.Debug|x64.Build.0 = Debug|Any CPU
+ {829AF806-1144-408A-85FE-763835775086}.Release|x64.ActiveCfg = Release|Any CPU
+ {829AF806-1144-408A-85FE-763835775086}.Release|x64.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {FC829F1B-43AD-4C96-9002-23D04BBA3AF3} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
+ {762EECAA-122E-4B0C-BC50-5AA4F72CA4E0} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
+ {47BF715B-A0BF-4044-B335-717E56422550} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
+ {0AC8A7E9-6839-4B4C-B299-950C376DF71F} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
+ {829AF806-1144-408A-85FE-763835775086} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
+ EndGlobalSection
+EndGlobal
diff --git a/EventStore.Client.sln.DotSettings b/Kurrent.Client.sln.DotSettings
similarity index 99%
rename from EventStore.Client.sln.DotSettings
rename to Kurrent.Client.sln.DotSettings
index f97c72463..e12ac8bcf 100644
--- a/EventStore.Client.sln.DotSettings
+++ b/Kurrent.Client.sln.DotSettings
@@ -390,6 +390,7 @@
True
True
True
+ True
True
True
True
diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props
index 54497a508..1ab3aed15 100644
--- a/samples/Directory.Build.props
+++ b/samples/Directory.Build.props
@@ -1,6 +1,6 @@
- net8.0
+ net8.0;net9.0
enable
enable
true
@@ -12,4 +12,4 @@
-
\ No newline at end of file
+
diff --git a/samples/Samples.sln b/samples/Samples.sln
index 79c979342..ec2611d7b 100644
--- a/samples/Samples.sln
+++ b/samples/Samples.sln
@@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "quick-start", "quick-start\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client", "client", "{EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.Streams", "..\src\EventStore.Client.Streams\EventStore.Client.Streams.csproj", "{A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client", "..\src\EventStore.Client\EventStore.Client.csproj", "{A71A13F7-8480-4E48-B88D-A2364F7C95B6}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "connecting-to-a-cluster", "connecting-to-a-cluster\connecting-to-a-cluster.csproj", "{C4CA324A-450D-4621-82F1-B4ECD18216B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "appending-events", "appending-events\appending-events.csproj", "{496D9886-AF65-4579-AECE-2C147B9AF3C1}"
@@ -29,17 +25,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "server-side-filtering", "se
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "persistent-subscriptions", "persistent-subscriptions\persistent-subscriptions.csproj", "{A5A5EF0D-1AE4-4647-823D-FA172E8858F2}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.PersistentSubscriptions", "..\src\EventStore.Client.PersistentSubscriptions\EventStore.Client.PersistentSubscriptions.csproj", "{7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.ProjectionManagement", "..\src\EventStore.Client.ProjectionManagement\EventStore.Client.ProjectionManagement.csproj", "{79992D7B-C311-4E8A-856F-896C1EA61042}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projection-management", "projection-management\projection-management.csproj", "{9DEA2684-C38B-465C-91A6-ED2AB67A4338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "diagnostics", "diagnostics\diagnostics.csproj", "{546496AD-E355-4C20-930C-30D0FC76D26F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "user-certificates", "user-certificates\user-certificates.csproj", "{28112410-D02D-427A-9D36-3FE3A6DC6B0D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStore.Client.Extensions.OpenTelemetry", "..\src\EventStore.Client.Extensions.OpenTelemetry\EventStore.Client.Extensions.OpenTelemetry.csproj", "{29E3F07A-6676-45C1-805C-46BDF6CF325B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client", "..\src\Kurrent.Client\Kurrent.Client.csproj", "{16F61817-6E46-4F52-879F-E4B92A6A90C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -51,14 +43,6 @@ Global
{521987E5-4394-4EE0-B217-E3DC9DB0D327}.Debug|Any CPU.Build.0 = Debug|Any CPU
{521987E5-4394-4EE0-B217-E3DC9DB0D327}.Release|Any CPU.ActiveCfg = Release|Any CPU
{521987E5-4394-4EE0-B217-E3DC9DB0D327}.Release|Any CPU.Build.0 = Release|Any CPU
- {A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}.Release|Any CPU.Build.0 = Release|Any CPU
- {A71A13F7-8480-4E48-B88D-A2364F7C95B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A71A13F7-8480-4E48-B88D-A2364F7C95B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A71A13F7-8480-4E48-B88D-A2364F7C95B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A71A13F7-8480-4E48-B88D-A2364F7C95B6}.Release|Any CPU.Build.0 = Release|Any CPU
{C4CA324A-450D-4621-82F1-B4ECD18216B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4CA324A-450D-4621-82F1-B4ECD18216B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4CA324A-450D-4621-82F1-B4ECD18216B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -95,14 +79,6 @@ Global
{A5A5EF0D-1AE4-4647-823D-FA172E8858F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5A5EF0D-1AE4-4647-823D-FA172E8858F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5A5EF0D-1AE4-4647-823D-FA172E8858F2}.Release|Any CPU.Build.0 = Release|Any CPU
- {7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}.Release|Any CPU.Build.0 = Release|Any CPU
- {79992D7B-C311-4E8A-856F-896C1EA61042}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {79992D7B-C311-4E8A-856F-896C1EA61042}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {79992D7B-C311-4E8A-856F-896C1EA61042}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {79992D7B-C311-4E8A-856F-896C1EA61042}.Release|Any CPU.Build.0 = Release|Any CPU
{9DEA2684-C38B-465C-91A6-ED2AB67A4338}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9DEA2684-C38B-465C-91A6-ED2AB67A4338}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9DEA2684-C38B-465C-91A6-ED2AB67A4338}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -115,20 +91,16 @@ Global
{28112410-D02D-427A-9D36-3FE3A6DC6B0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28112410-D02D-427A-9D36-3FE3A6DC6B0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28112410-D02D-427A-9D36-3FE3A6DC6B0D}.Release|Any CPU.Build.0 = Release|Any CPU
- {29E3F07A-6676-45C1-805C-46BDF6CF325B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {29E3F07A-6676-45C1-805C-46BDF6CF325B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {29E3F07A-6676-45C1-805C-46BDF6CF325B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {29E3F07A-6676-45C1-805C-46BDF6CF325B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {16F61817-6E46-4F52-879F-E4B92A6A90C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {16F61817-6E46-4F52-879F-E4B92A6A90C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {16F61817-6E46-4F52-879F-E4B92A6A90C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {16F61817-6E46-4F52-879F-E4B92A6A90C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
- {A71A13F7-8480-4E48-B88D-A2364F7C95B6} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
- {7200BB01-A405-45D5-A6E8-A8FA8DE39DA0} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
- {79992D7B-C311-4E8A-856F-896C1EA61042} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
- {29E3F07A-6676-45C1-805C-46BDF6CF325B} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
+ {16F61817-6E46-4F52-879F-E4B92A6A90C6} = {EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E7E3A6C-21DA-4DBD-9EB3-68DFC5CDE48F}
diff --git a/samples/Samples.sln.DotSettings b/samples/Samples.sln.DotSettings
index c341e4095..06c105615 100644
--- a/samples/Samples.sln.DotSettings
+++ b/samples/Samples.sln.DotSettings
@@ -390,6 +390,7 @@
True
True
True
+ True
True
True
True
diff --git a/samples/appending-events/Program.cs b/samples/appending-events/Program.cs
index 2e1bb758f..98f12fb1a 100644
--- a/samples/appending-events/Program.cs
+++ b/samples/appending-events/Program.cs
@@ -1,10 +1,10 @@
#pragma warning disable CS8321 // Local function is declared but never used
-var settings = EventStoreClientSettings.Create("esdb://localhost:2113?tls=false");
+var settings = KurrentClientSettings.Create("esdb://localhost:2113?tls=false");
settings.OperationOptions.ThrowOnAppendFailure = false;
-await using var client = new EventStoreClient(settings);
+await using var client = new KurrentClient(settings);
await AppendToStream(client);
await AppendWithConcurrencyCheck(client);
@@ -13,7 +13,7 @@
return;
-static async Task AppendToStream(EventStoreClient client) {
+static async Task AppendToStream(KurrentClient client) {
#region append-to-stream
var eventData = new EventData(
@@ -33,7 +33,7 @@ await client.AppendToStreamAsync(
#endregion append-to-stream
}
-static async Task AppendWithSameId(EventStoreClient client) {
+static async Task AppendWithSameId(KurrentClient client) {
#region append-duplicate-event
var eventData = new EventData(
@@ -62,7 +62,7 @@ await client.AppendToStreamAsync(
#endregion append-duplicate-event
}
-static async Task AppendWithNoStream(EventStoreClient client) {
+static async Task AppendWithNoStream(KurrentClient client) {
#region append-with-no-stream
var eventDataOne = new EventData(
@@ -97,7 +97,7 @@ await client.AppendToStreamAsync(
#endregion append-with-no-stream
}
-static async Task AppendWithConcurrencyCheck(EventStoreClient client) {
+static async Task AppendWithConcurrencyCheck(KurrentClient client) {
await client.AppendToStreamAsync(
"concurrency-stream",
StreamRevision.None,
@@ -148,7 +148,7 @@ await client.AppendToStreamAsync(
#endregion append-with-concurrency-check
}
-static async Task AppendOverridingUserCredentials(EventStoreClient client, CancellationToken cancellationToken) {
+static async Task AppendOverridingUserCredentials(KurrentClient client, CancellationToken cancellationToken) {
var eventData = new EventData(
Uuid.NewUuid(),
"TestEvent",
diff --git a/samples/appending-events/appending-events.csproj b/samples/appending-events/appending-events.csproj
index fb93d800e..c74c70ae9 100644
--- a/samples/appending-events/appending-events.csproj
+++ b/samples/appending-events/appending-events.csproj
@@ -3,11 +3,7 @@
Exe
appending_events
-
-
-
-
-
+
diff --git a/samples/connecting-to-a-cluster/Program.cs b/samples/connecting-to-a-cluster/Program.cs
index a31666fc6..01b033c6c 100644
--- a/samples/connecting-to-a-cluster/Program.cs
+++ b/samples/connecting-to-a-cluster/Program.cs
@@ -1,10 +1,12 @@
-#pragma warning disable CS8321 // Local function is declared but never used
+using EventStore.Client;
+
+#pragma warning disable CS8321 // Local function is declared but never used
static void ConnectingToACluster() {
#region connecting-to-a-cluster
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create("esdb://localhost:1114,localhost:2114,localhost:3114")
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create("esdb://localhost:1114,localhost:2114,localhost:3114")
);
#endregion connecting-to-a-cluster
@@ -13,8 +15,8 @@ static void ConnectingToACluster() {
static void ProvidingDefaultCredentials() {
#region providing-default-credentials
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create("esdb://admin:changeit@localhost:1114,localhost:2114,localhost:3114")
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create("esdb://admin:changeit@localhost:1114,localhost:2114,localhost:3114")
);
#endregion providing-default-credentials
@@ -23,11 +25,11 @@ static void ProvidingDefaultCredentials() {
static void ConnectingToAClusterComplex() {
#region connecting-to-a-cluster-complex
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create(
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create(
"esdb://admin:changeit@localhost:1114,localhost:2114,localhost:3114?DiscoveryInterval=30000;GossipTimeout=10000;NodePreference=leader;MaxDiscoverAttempts=5"
)
);
#endregion connecting-to-a-cluster-complex
-}
\ No newline at end of file
+}
diff --git a/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj b/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj
index 4754bd0e2..f7304d3f3 100644
--- a/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj
+++ b/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj
@@ -3,11 +3,7 @@
Exe
connecting_to_a_cluster
-
-
-
-
-
+
diff --git a/samples/connecting-to-a-single-node/Program.cs b/samples/connecting-to-a-single-node/Program.cs
index f50e1689f..63d0b3e98 100644
--- a/samples/connecting-to-a-single-node/Program.cs
+++ b/samples/connecting-to-a-single-node/Program.cs
@@ -1,11 +1,12 @@
using connecting_to_a_single_node;
+using EventStore.Client;
#pragma warning disable CS8321 // Local function is declared but never used
static void SimpleConnection() {
#region creating-simple-connection
- using var client = new EventStoreClient(EventStoreClientSettings.Create("esdb://localhost:2113"));
+ using var client = new KurrentClient(KurrentClientSettings.Create("esdb://localhost:2113"));
#endregion creating-simple-connection
}
@@ -13,7 +14,7 @@ static void SimpleConnection() {
static void ProvidingDefaultCredentials() {
#region providing-default-credentials
- using var client = new EventStoreClient(EventStoreClientSettings.Create("esdb://admin:changeit@localhost:2113"));
+ using var client = new KurrentClient(KurrentClientSettings.Create("esdb://admin:changeit@localhost:2113"));
#endregion providing-default-credentials
}
@@ -21,8 +22,8 @@ static void ProvidingDefaultCredentials() {
static void SpecifyingAConnectionName() {
#region setting-the-connection-name
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create("esdb://admin:changeit@localhost:2113?ConnectionName=SomeConnection")
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create("esdb://admin:changeit@localhost:2113?ConnectionName=SomeConnection")
);
#endregion setting-the-connection-name
@@ -31,8 +32,8 @@ static void SpecifyingAConnectionName() {
static void OverridingTheTimeout() {
#region overriding-timeout
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create($"esdb://admin:changeit@localhost:2113?OperationTimeout=30000")
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create($"esdb://admin:changeit@localhost:2113?OperationTimeout=30000")
);
#endregion overriding-timeout
@@ -41,8 +42,8 @@ static void OverridingTheTimeout() {
static void CombiningSettings() {
#region overriding-timeout
- using var client = new EventStoreClient(
- EventStoreClientSettings.Create(
+ using var client = new KurrentClient(
+ KurrentClientSettings.Create(
$"esdb://admin:changeit@localhost:2113?ConnectionName=SomeConnection&OperationTimeout=30000"
)
);
@@ -53,7 +54,7 @@ static void CombiningSettings() {
static void CreatingAnInterceptor() {
#region adding-an-interceptor
- var settings = new EventStoreClientSettings {
+ var settings = new KurrentClientSettings {
Interceptors = new[] { new DemoInterceptor() },
ConnectivitySettings = {
Address = new Uri("https://localhost:2113")
@@ -62,13 +63,13 @@ static void CreatingAnInterceptor() {
#endregion adding-an-interceptor
- var client = new EventStoreClient(settings);
+ var client = new KurrentClient(settings);
}
static void CustomHttpMessageHandler() {
#region adding-an-custom-http-message-handler
- var settings = new EventStoreClientSettings {
+ var settings = new KurrentClientSettings {
CreateHttpMessageHandler = () =>
new HttpClientHandler {
ServerCertificateCustomValidationCallback =
@@ -81,5 +82,5 @@ static void CustomHttpMessageHandler() {
#endregion adding-an-custom-http-message-handler
- var client = new EventStoreClient(settings);
-}
\ No newline at end of file
+ var client = new KurrentClient(settings);
+}
diff --git a/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj b/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj
index 4ef794ee4..97609c80a 100644
--- a/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj
+++ b/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj
@@ -2,11 +2,7 @@
Exe
-
-
-
-
-
+
diff --git a/samples/diagnostics/Program.cs b/samples/diagnostics/Program.cs
index 5804be7a4..86f9a6e3a 100644
--- a/samples/diagnostics/Program.cs
+++ b/samples/diagnostics/Program.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using EventStore.Client;
using EventStore.Client.Extensions.OpenTelemetry;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -23,17 +24,17 @@ dotnet add package OpenTelemetry.Extensions.Hosting
# endregion import-required-packages
**/
-var settings = EventStoreClientSettings.Create("esdb://localhost:2113?tls=false");
+var settings = KurrentClientSettings.Create("esdb://localhost:2113?tls=false");
settings.OperationOptions.ThrowOnAppendFailure = false;
-await using var client = new EventStoreClient(settings);
+await using var client = new KurrentClient(settings);
await TraceAppendToStream(client);
return;
-static async Task TraceAppendToStream(EventStoreClient client) {
+static async Task TraceAppendToStream(KurrentClient client) {
const string serviceName = "sample";
var host = Host.CreateDefaultBuilder()
@@ -76,7 +77,7 @@ static void ConfigureTracerProviderBuilder(TracerProviderBuilder tracerProviderB
#region register-instrumentation
tracerProviderBuilder
- .AddEventStoreClientInstrumentation();
+ .AddKurrentClientInstrumentation();
#endregion register-instrumentation
diff --git a/samples/diagnostics/diagnostics.csproj b/samples/diagnostics/diagnostics.csproj
index 1763a9d9e..56bd7c49c 100644
--- a/samples/diagnostics/diagnostics.csproj
+++ b/samples/diagnostics/diagnostics.csproj
@@ -5,18 +5,14 @@
-
-
-
+
+
+
-
+
-
-
-
-
-
+
diff --git a/samples/persistent-subscriptions/Program.cs b/samples/persistent-subscriptions/Program.cs
index e1e9387c6..6d07b7947 100644
--- a/samples/persistent-subscriptions/Program.cs
+++ b/samples/persistent-subscriptions/Program.cs
@@ -1,5 +1,5 @@
-await using var client = new EventStorePersistentSubscriptionsClient(
- EventStoreClientSettings.Create("esdb://localhost:2113?tls=false&tlsVerifyCert=false")
+await using var client = new KurrentPersistentSubscriptionsClient(
+ KurrentClientSettings.Create("esdb://localhost:2113?tls=false&tlsVerifyCert=false")
);
await DeletePersistentSubscription(client);
@@ -36,7 +36,7 @@
return;
-static async Task CreatePersistentSubscription(EventStorePersistentSubscriptionsClient client) {
+static async Task CreatePersistentSubscription(KurrentPersistentSubscriptionsClient client) {
#region create-persistent-subscription-to-stream
var userCredentials = new UserCredentials("admin", "changeit");
@@ -54,7 +54,7 @@ await client.CreateToStreamAsync(
#endregion create-persistent-subscription-to-stream
}
-static async Task ConnectToPersistentSubscriptionToStream(EventStorePersistentSubscriptionsClient client,
+static async Task ConnectToPersistentSubscriptionToStream(KurrentPersistentSubscriptionsClient client,
CancellationToken ct) {
#region subscribe-to-persistent-subscription-to-stream
@@ -77,7 +77,7 @@ static async Task ConnectToPersistentSubscriptionToStream(EventStorePersistentSu
#endregion subscribe-to-persistent-subscription-to-stream
}
-static async Task CreatePersistentSubscriptionToAll(EventStorePersistentSubscriptionsClient client) {
+static async Task CreatePersistentSubscriptionToAll(KurrentPersistentSubscriptionsClient client) {
#region create-persistent-subscription-to-all
var userCredentials = new UserCredentials("admin", "changeit");
@@ -96,7 +96,7 @@ await client.CreateToAllAsync(
#endregion create-persistent-subscription-to-all
}
-static async Task ConnectToPersistentSubscriptionToAll(EventStorePersistentSubscriptionsClient client,
+static async Task ConnectToPersistentSubscriptionToAll(KurrentPersistentSubscriptionsClient client,
CancellationToken ct) {
#region subscribe-to-persistent-subscription-to-all
@@ -118,7 +118,7 @@ static async Task ConnectToPersistentSubscriptionToAll(EventStorePersistentSubsc
#endregion subscribe-to-persistent-subscription-to-all
}
-static async Task ConnectToPersistentSubscriptionWithManualAcks(EventStorePersistentSubscriptionsClient client,
+static async Task ConnectToPersistentSubscriptionWithManualAcks(KurrentPersistentSubscriptionsClient client,
CancellationToken ct) {
#region subscribe-to-persistent-subscription-with-manual-acks
@@ -145,7 +145,7 @@ static async Task ConnectToPersistentSubscriptionWithManualAcks(EventStorePersis
#endregion subscribe-to-persistent-subscription-with-manual-acks
}
-static async Task UpdatePersistentSubscription(EventStorePersistentSubscriptionsClient client) {
+static async Task UpdatePersistentSubscription(KurrentPersistentSubscriptionsClient client) {
#region update-persistent-subscription
var userCredentials = new UserCredentials("admin", "changeit");
@@ -163,7 +163,7 @@ await client.UpdateToStreamAsync(
#endregion update-persistent-subscription
}
-static async Task DeletePersistentSubscription(EventStorePersistentSubscriptionsClient client) {
+static async Task DeletePersistentSubscription(KurrentPersistentSubscriptionsClient client) {
#region delete-persistent-subscription
try {
@@ -184,7 +184,7 @@ await client.DeleteToStreamAsync(
#endregion delete-persistent-subscription
}
-static async Task DeletePersistentSubscriptionToAll(EventStorePersistentSubscriptionsClient client) {
+static async Task DeletePersistentSubscriptionToAll(KurrentPersistentSubscriptionsClient client) {
#region delete-persistent-subscription-to-all
try {
@@ -204,7 +204,7 @@ await client.DeleteToAllAsync(
#endregion delete-persistent-subscription-to-all
}
-static async Task GetPersistentSubscriptionToStreamInfo(EventStorePersistentSubscriptionsClient client) {
+static async Task GetPersistentSubscriptionToStreamInfo(KurrentPersistentSubscriptionsClient client) {
#region get-persistent-subscription-to-stream-info
var userCredentials = new UserCredentials("admin", "changeit");
@@ -219,7 +219,7 @@ static async Task GetPersistentSubscriptionToStreamInfo(EventStorePersistentSubs
#endregion get-persistent-subscription-to-stream-info
}
-static async Task GetPersistentSubscriptionToAllInfo(EventStorePersistentSubscriptionsClient client) {
+static async Task GetPersistentSubscriptionToAllInfo(KurrentPersistentSubscriptionsClient client) {
#region get-persistent-subscription-to-all-info
var userCredentials = new UserCredentials("admin", "changeit");
@@ -233,7 +233,7 @@ static async Task GetPersistentSubscriptionToAllInfo(EventStorePersistentSubscri
#endregion get-persistent-subscription-to-all-info
}
-static async Task ReplayParkedToStream(EventStorePersistentSubscriptionsClient client) {
+static async Task ReplayParkedToStream(KurrentPersistentSubscriptionsClient client) {
#region replay-parked-of-persistent-subscription-to-stream
var userCredentials = new UserCredentials("admin", "changeit");
@@ -249,7 +249,7 @@ await client.ReplayParkedMessagesToStreamAsync(
#endregion persistent-subscription-replay-parked-to-stream
}
-static async Task ReplayParkedToAll(EventStorePersistentSubscriptionsClient client) {
+static async Task ReplayParkedToAll(KurrentPersistentSubscriptionsClient client) {
#region replay-parked-of-persistent-subscription-to-all
var userCredentials = new UserCredentials("admin", "changeit");
@@ -264,7 +264,7 @@ await client.ReplayParkedMessagesToAllAsync(
#endregion replay-parked-of-persistent-subscription-to-all
}
-static async Task ListPersistentSubscriptionsToStream(EventStorePersistentSubscriptionsClient client) {
+static async Task ListPersistentSubscriptionsToStream(KurrentPersistentSubscriptionsClient client) {
#region list-persistent-subscriptions-to-stream
var userCredentials = new UserCredentials("admin", "changeit");
@@ -281,7 +281,7 @@ static async Task ListPersistentSubscriptionsToStream(EventStorePersistentSubscr
#endregion list-persistent-subscriptions-to-stream
}
-static async Task ListPersistentSubscriptionsToAll(EventStorePersistentSubscriptionsClient client) {
+static async Task ListPersistentSubscriptionsToAll(KurrentPersistentSubscriptionsClient client) {
#region list-persistent-subscriptions-to-all
var userCredentials = new UserCredentials("admin", "changeit");
@@ -295,7 +295,7 @@ static async Task ListPersistentSubscriptionsToAll(EventStorePersistentSubscript
#endregion list-persistent-subscriptions-to-all
}
-static async Task ListAllPersistentSubscriptions(EventStorePersistentSubscriptionsClient client) {
+static async Task ListAllPersistentSubscriptions(KurrentPersistentSubscriptionsClient client) {
#region list-persistent-subscriptions
var userCredentials = new UserCredentials("admin", "changeit");
@@ -309,7 +309,7 @@ static async Task ListAllPersistentSubscriptions(EventStorePersistentSubscriptio
#endregion list-persistent-subscriptions
}
-static async Task RestartPersistentSubscriptionSubsystem(EventStorePersistentSubscriptionsClient client) {
+static async Task RestartPersistentSubscriptionSubsystem(KurrentPersistentSubscriptionsClient client) {
#region restart-persistent-subscription-subsystem
var userCredentials = new UserCredentials("admin", "changeit");
diff --git a/samples/persistent-subscriptions/persistent-subscriptions.csproj b/samples/persistent-subscriptions/persistent-subscriptions.csproj
index e845bda8e..e296fca91 100644
--- a/samples/persistent-subscriptions/persistent-subscriptions.csproj
+++ b/samples/persistent-subscriptions/persistent-subscriptions.csproj
@@ -3,10 +3,7 @@
Exe
persistent_subscriptions
-
-
-
-
+
diff --git a/samples/projection-management/Program.cs b/samples/projection-management/Program.cs
index 0f3d66b70..478b88b10 100644
--- a/samples/projection-management/Program.cs
+++ b/samples/projection-management/Program.cs
@@ -64,20 +64,20 @@
return;
-static EventStoreProjectionManagementClient ManagementClient(string connection) {
+static KurrentProjectionManagementClient ManagementClient(string connection) {
#region createClient
- var settings = EventStoreClientSettings.Create(connection);
+ var settings = KurrentClientSettings.Create(connection);
settings.ConnectionName = "Projection management client";
settings.DefaultCredentials = new UserCredentials("admin", "changeit");
- var managementClient = new EventStoreProjectionManagementClient(settings);
+ var managementClient = new KurrentProjectionManagementClient(settings);
#endregion createClient
return managementClient;
}
-static async Task RestartSubSystem(EventStoreProjectionManagementClient managementClient) {
+static async Task RestartSubSystem(KurrentProjectionManagementClient managementClient) {
#region RestartSubSystem
await managementClient.RestartSubsystemAsync();
@@ -85,7 +85,7 @@ static async Task RestartSubSystem(EventStoreProjectionManagementClient manageme
#endregion RestartSubSystem
}
-static async Task Disable(EventStoreProjectionManagementClient managementClient) {
+static async Task Disable(KurrentProjectionManagementClient managementClient) {
#region Disable
await managementClient.DisableAsync("$by_category");
@@ -93,7 +93,7 @@ static async Task Disable(EventStoreProjectionManagementClient managementClient)
#endregion Disable
}
-static async Task DisableNotFound(EventStoreProjectionManagementClient managementClient) {
+static async Task DisableNotFound(KurrentProjectionManagementClient managementClient) {
#region DisableNotFound
try {
@@ -109,7 +109,7 @@ static async Task DisableNotFound(EventStoreProjectionManagementClient managemen
#endregion DisableNotFound
}
-static async Task Enable(EventStoreProjectionManagementClient managementClient) {
+static async Task Enable(KurrentProjectionManagementClient managementClient) {
#region Enable
await managementClient.EnableAsync("$by_category");
@@ -117,7 +117,7 @@ static async Task Enable(EventStoreProjectionManagementClient managementClient)
#endregion Enable
}
-static async Task EnableNotFound(EventStoreProjectionManagementClient managementClient) {
+static async Task EnableNotFound(KurrentProjectionManagementClient managementClient) {
#region EnableNotFound
try {
@@ -133,7 +133,7 @@ static async Task EnableNotFound(EventStoreProjectionManagementClient management
#endregion EnableNotFound
}
-static Task Delete(EventStoreProjectionManagementClient managementClient) {
+static Task Delete(KurrentProjectionManagementClient managementClient) {
#region Delete
// this is not yet available in the .net grpc client
@@ -143,7 +143,7 @@ static Task Delete(EventStoreProjectionManagementClient managementClient) {
return Task.CompletedTask;
}
-static async Task Abort(EventStoreProjectionManagementClient managementClient) {
+static async Task Abort(KurrentProjectionManagementClient managementClient) {
try {
var js =
"fromAll() .when({$init:function(){return {count:0};},$any:function(s, e){s.count += 1;}}).outputState();";
@@ -165,7 +165,7 @@ static async Task Abort(EventStoreProjectionManagementClient managementClient) {
#endregion Abort
}
-static async Task Abort_NotFound(EventStoreProjectionManagementClient managementClient) {
+static async Task Abort_NotFound(KurrentProjectionManagementClient managementClient) {
#region Abort_NotFound
try {
@@ -181,7 +181,7 @@ static async Task Abort_NotFound(EventStoreProjectionManagementClient management
#endregion Abort_NotFound
}
-static async Task Reset(EventStoreProjectionManagementClient managementClient) {
+static async Task Reset(KurrentProjectionManagementClient managementClient) {
try {
var js =
"fromAll() .when({$init:function(){return {count:0};},$any:function(s, e){s.count += 1;}}).outputState();";
@@ -203,7 +203,7 @@ static async Task Reset(EventStoreProjectionManagementClient managementClient) {
#endregion Reset
}
-static async Task Reset_NotFound(EventStoreProjectionManagementClient managementClient) {
+static async Task Reset_NotFound(KurrentProjectionManagementClient managementClient) {
#region Reset_NotFound
try {
@@ -219,14 +219,14 @@ static async Task Reset_NotFound(EventStoreProjectionManagementClient management
#endregion Reset_NotFound
}
-static async Task CreateOneTime(EventStoreProjectionManagementClient managementClient) {
+static async Task CreateOneTime(KurrentProjectionManagementClient managementClient) {
const string js =
"fromAll() .when({$init:function(){return {count:0};},$any:function(s, e){s.count += 1;}}).outputState();";
await managementClient.CreateOneTimeAsync(js);
}
-static async Task CreateContinuous(EventStoreProjectionManagementClient managementClient) {
+static async Task CreateContinuous(KurrentProjectionManagementClient managementClient) {
#region CreateContinuous
const string js = @"fromAll()
@@ -248,7 +248,7 @@ static async Task CreateContinuous(EventStoreProjectionManagementClient manageme
#endregion CreateContinuous
}
-static async Task CreateContinuous_Conflict(EventStoreProjectionManagementClient managementClient) {
+static async Task CreateContinuous_Conflict(KurrentProjectionManagementClient managementClient) {
const string js = @"fromAll()
.when({
$init: function() {
@@ -281,7 +281,7 @@ static async Task CreateContinuous_Conflict(EventStoreProjectionManagementClient
#endregion CreateContinuous_Conflict
}
-static async Task Update(EventStoreProjectionManagementClient managementClient) {
+static async Task Update(KurrentProjectionManagementClient managementClient) {
#region Update
const string js = @"fromAll()
@@ -305,7 +305,7 @@ static async Task Update(EventStoreProjectionManagementClient managementClient)
#endregion Update
}
-static async Task Update_NotFound(EventStoreProjectionManagementClient managementClient) {
+static async Task Update_NotFound(KurrentProjectionManagementClient managementClient) {
#region Update_NotFound
try {
@@ -321,7 +321,7 @@ static async Task Update_NotFound(EventStoreProjectionManagementClient managemen
#endregion Update_NotFound
}
-static async Task ListAll(EventStoreProjectionManagementClient managementClient) {
+static async Task ListAll(KurrentProjectionManagementClient managementClient) {
#region ListAll
var details = managementClient.ListAllAsync();
@@ -333,7 +333,7 @@ static async Task ListAll(EventStoreProjectionManagementClient managementClient)
#endregion ListAll
}
-static async Task ListContinuous(EventStoreProjectionManagementClient managementClient) {
+static async Task ListContinuous(KurrentProjectionManagementClient managementClient) {
#region ListContinuous
var details = managementClient.ListContinuousAsync();
@@ -345,7 +345,7 @@ static async Task ListContinuous(EventStoreProjectionManagementClient management
#endregion ListContinuous
}
-static async Task GetStatus(EventStoreProjectionManagementClient managementClient) {
+static async Task GetStatus(KurrentProjectionManagementClient managementClient) {
const string js =
"fromAll().when({$init:function(){return {count:0};},$any:function(s, e){s.count += 1;}}).outputState();";
@@ -362,7 +362,7 @@ static async Task GetStatus(EventStoreProjectionManagementClient managementClien
#endregion GetStatus
}
-static async Task GetState(EventStoreProjectionManagementClient managementClient) {
+static async Task GetState(KurrentProjectionManagementClient managementClient) {
// will have to wait for the client to be fixed before we import in the doc
#region GetState
@@ -393,7 +393,7 @@ static async Task DocToString(JsonDocument d) {
#endregion GetState
}
-static async Task GetResult(EventStoreProjectionManagementClient managementClient) {
+static async Task GetResult(KurrentProjectionManagementClient managementClient) {
#region GetResult
const string js = @"fromAll()
@@ -433,9 +433,9 @@ static string DocToString(JsonDocument d) {
}
static async Task Populate(string connection, int numberOfEvents) {
- var settings = EventStoreClientSettings.Create(connection);
+ var settings = KurrentClientSettings.Create(connection);
settings.DefaultCredentials = new UserCredentials("admin", "changeit");
- var client = new EventStoreClient(settings);
+ var client = new KurrentClient(settings);
var messages = Enumerable.Range(0, numberOfEvents).Select(
number =>
new EventData(
@@ -452,4 +452,4 @@ public class Result {
public int count { get; set; }
public override string ToString() => $"count= {count}";
-};
\ No newline at end of file
+};
diff --git a/samples/projection-management/projection-management.csproj b/samples/projection-management/projection-management.csproj
index 3b5b2c3c7..f6a6206aa 100644
--- a/samples/projection-management/projection-management.csproj
+++ b/samples/projection-management/projection-management.csproj
@@ -2,9 +2,7 @@
projection_management
-
-
-
+
diff --git a/samples/quick-start/Program.cs b/samples/quick-start/Program.cs
index 0cd070137..dd763ae42 100644
--- a/samples/quick-start/Program.cs
+++ b/samples/quick-start/Program.cs
@@ -7,9 +7,9 @@
const string connectionString = "esdb://admin:changeit@localhost:2113?tls=false&tlsVerifyCert=false";
-var settings = EventStoreClientSettings.Create(connectionString);
+var settings = KurrentClientSettings.Create(connectionString);
-var client = new EventStoreClient(settings);
+var client = new KurrentClient(settings);
#endregion createClient
@@ -67,4 +67,4 @@ await client.AppendToStreamAsync(
public class TestEvent {
public string? EntityId { get; set; }
public string? ImportantData { get; set; }
-}
\ No newline at end of file
+}
diff --git a/samples/quick-start/quick-start.csproj b/samples/quick-start/quick-start.csproj
index b33948026..5fe35463c 100644
--- a/samples/quick-start/quick-start.csproj
+++ b/samples/quick-start/quick-start.csproj
@@ -2,11 +2,7 @@
quick_start
-
-
-
-
-
+
diff --git a/samples/reading-events/Program.cs b/samples/reading-events/Program.cs
index 854634da8..751086d5c 100644
--- a/samples/reading-events/Program.cs
+++ b/samples/reading-events/Program.cs
@@ -1,6 +1,6 @@
#pragma warning disable CS8321 // Local function is declared but never used
-await using var client = new EventStoreClient(EventStoreClientSettings.Create("esdb://localhost:2113?tls=false"));
+await using var client = new KurrentClient(KurrentClientSettings.Create("esdb://localhost:2113?tls=false"));
var events = Enumerable.Range(0, 20)
.Select(
@@ -21,7 +21,7 @@ await client.AppendToStreamAsync(
return;
-static async Task ReadFromStream(EventStoreClient client) {
+static async Task ReadFromStream(KurrentClient client) {
#region read-from-stream
var events = client.ReadStreamAsync(
@@ -46,7 +46,7 @@ static async Task ReadFromStream(EventStoreClient client) {
#endregion
}
-static async Task ReadFromStreamMessages(EventStoreClient client) {
+static async Task ReadFromStreamMessages(KurrentClient client) {
#region read-from-stream-messages
var streamPosition = StreamPosition.Start;
@@ -90,7 +90,7 @@ static async Task ReadFromStreamMessages(EventStoreClient client) {
#endregion iterate-stream-messages
}
-static async Task ReadFromStreamPosition(EventStoreClient client) {
+static async Task ReadFromStreamPosition(KurrentClient client) {
#region read-from-stream-position
var events = client.ReadStreamAsync(
@@ -109,7 +109,7 @@ static async Task ReadFromStreamPosition(EventStoreClient client) {
#endregion iterate-stream
}
-static async Task ReadFromStreamPositionCheck(EventStoreClient client) {
+static async Task ReadFromStreamPositionCheck(KurrentClient client) {
#region checking-for-stream-presence
var result = client.ReadStreamAsync(
@@ -126,7 +126,7 @@ static async Task ReadFromStreamPositionCheck(EventStoreClient client) {
#endregion checking-for-stream-presence
}
-static async Task ReadFromStreamBackwards(EventStoreClient client) {
+static async Task ReadFromStreamBackwards(KurrentClient client) {
#region reading-backwards
var events = client.ReadStreamAsync(
@@ -140,7 +140,7 @@ static async Task ReadFromStreamBackwards(EventStoreClient client) {
#endregion reading-backwards
}
-static async Task ReadFromStreamMessagesBackwards(EventStoreClient client) {
+static async Task ReadFromStreamMessagesBackwards(KurrentClient client) {
#region read-from-stream-messages-backwards
var results = client.ReadStreamAsync(
@@ -175,7 +175,7 @@ static async Task ReadFromStreamMessagesBackwards(EventStoreClient client) {
#endregion iterate-stream-messages-backwards
}
-static async Task ReadFromAllStream(EventStoreClient client) {
+static async Task ReadFromAllStream(KurrentClient client) {
#region read-from-all-stream
var events = client.ReadAllAsync(Direction.Forwards, Position.Start);
@@ -189,7 +189,7 @@ static async Task ReadFromAllStream(EventStoreClient client) {
#endregion read-from-all-stream-iterate
}
-static async Task ReadFromAllStreamMessages(EventStoreClient client) {
+static async Task ReadFromAllStreamMessages(KurrentClient client) {
#region read-from-all-stream-messages
var position = Position.Start;
@@ -216,7 +216,7 @@ static async Task ReadFromAllStreamMessages(EventStoreClient client) {
#endregion iterate-all-stream-messages
}
-static async Task IgnoreSystemEvents(EventStoreClient client) {
+static async Task IgnoreSystemEvents(KurrentClient client) {
#region ignore-system-events
var events = client.ReadAllAsync(Direction.Forwards, Position.Start);
@@ -230,7 +230,7 @@ static async Task IgnoreSystemEvents(EventStoreClient client) {
#endregion ignore-system-events
}
-static async Task ReadFromAllStreamBackwards(EventStoreClient client) {
+static async Task ReadFromAllStreamBackwards(KurrentClient client) {
#region read-from-all-stream-backwards
var events = client.ReadAllAsync(Direction.Backwards, Position.End);
@@ -244,7 +244,7 @@ static async Task ReadFromAllStreamBackwards(EventStoreClient client) {
#endregion read-from-all-stream-iterate
}
-static async Task ReadFromAllStreamBackwardsMessages(EventStoreClient client) {
+static async Task ReadFromAllStreamBackwardsMessages(KurrentClient client) {
#region read-from-all-stream-messages-backwards
var position = Position.End;
@@ -272,7 +272,7 @@ static async Task ReadFromAllStreamBackwardsMessages(EventStoreClient client) {
#endregion iterate-all-stream-messages-backwards
}
-static async Task FilteringOutSystemEvents(EventStoreClient client) {
+static async Task FilteringOutSystemEvents(KurrentClient client) {
var events = client.ReadAllAsync(Direction.Forwards, Position.Start);
await foreach (var e in events)
@@ -280,7 +280,7 @@ static async Task FilteringOutSystemEvents(EventStoreClient client) {
Console.WriteLine(Encoding.UTF8.GetString(e.Event.Data.ToArray()));
}
-static void ReadStreamOverridingUserCredentials(EventStoreClient client, CancellationToken cancellationToken) {
+static void ReadStreamOverridingUserCredentials(KurrentClient client, CancellationToken cancellationToken) {
#region overriding-user-credentials
var result = client.ReadStreamAsync(
@@ -294,7 +294,7 @@ static void ReadStreamOverridingUserCredentials(EventStoreClient client, Cancell
#endregion overriding-user-credentials
}
-static void ReadAllOverridingUserCredentials(EventStoreClient client, CancellationToken cancellationToken) {
+static void ReadAllOverridingUserCredentials(KurrentClient client, CancellationToken cancellationToken) {
#region read-all-overriding-user-credentials
var result = client.ReadAllAsync(
@@ -307,7 +307,7 @@ static void ReadAllOverridingUserCredentials(EventStoreClient client, Cancellati
#endregion read-all-overriding-user-credentials
}
-static void ReadAllResolvingLinkTos(EventStoreClient client, CancellationToken cancellationToken) {
+static void ReadAllResolvingLinkTos(KurrentClient client, CancellationToken cancellationToken) {
#region read-from-all-stream-resolving-link-Tos
var result = client.ReadAllAsync(
@@ -318,4 +318,4 @@ static void ReadAllResolvingLinkTos(EventStoreClient client, CancellationToken c
);
#endregion read-from-all-stream-resolving-link-Tos
-}
\ No newline at end of file
+}
diff --git a/samples/reading-events/reading-events.csproj b/samples/reading-events/reading-events.csproj
index 436254ea7..d79ede9fc 100644
--- a/samples/reading-events/reading-events.csproj
+++ b/samples/reading-events/reading-events.csproj
@@ -2,10 +2,7 @@
reading_events
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/samples/secure-with-tls/Program.cs b/samples/secure-with-tls/Program.cs
index 621ee46b1..b2dcd05bb 100644
--- a/samples/secure-with-tls/Program.cs
+++ b/samples/secure-with-tls/Program.cs
@@ -6,7 +6,7 @@
Console.WriteLine($"Connecting to EventStoreDB at: {connectionString}");
-await using var client = new EventStoreClient(EventStoreClientSettings.Create(connectionString));
+await using var client = new KurrentClient(KurrentClientSettings.Create(connectionString));
var eventData = new EventData(Uuid.NewUuid(), "some-event", "{\"id\": \"1\" \"value\": \"some value\"}"u8.ToArray());
@@ -48,4 +48,4 @@
}
Console.WriteLine($"FAILED! {exception}");
-}
\ No newline at end of file
+}
diff --git a/samples/secure-with-tls/secure-with-tls.csproj b/samples/secure-with-tls/secure-with-tls.csproj
index 7dd4b7c03..a11ffdb55 100644
--- a/samples/secure-with-tls/secure-with-tls.csproj
+++ b/samples/secure-with-tls/secure-with-tls.csproj
@@ -14,8 +14,6 @@
-
-
-
+
diff --git a/samples/server-side-filtering/Program.cs b/samples/server-side-filtering/Program.cs
index b9e5de8c8..b8641905a 100644
--- a/samples/server-side-filtering/Program.cs
+++ b/samples/server-side-filtering/Program.cs
@@ -6,7 +6,7 @@
var semaphore = new SemaphoreSlim(eventCount);
-await using var client = new EventStoreClient(EventStoreClientSettings.Create("esdb://localhost:2113?tls=false"));
+await using var client = new KurrentClient(KurrentClientSettings.Create("esdb://localhost:2113?tls=false"));
_ = Task.Run(async () => {
await using var subscription = client.SubscribeToAll(
@@ -46,7 +46,7 @@ await client.AppendToStreamAsync(
return;
-static async Task ExcludeSystemEvents(EventStoreClient client) {
+static async Task ExcludeSystemEvents(KurrentClient client) {
#region exclude-system
await using var subscription = client.SubscribeToAll(
@@ -63,7 +63,7 @@ static async Task ExcludeSystemEvents(EventStoreClient client) {
#endregion exclude-system
}
-static async Task EventTypePrefix(EventStoreClient client) {
+static async Task EventTypePrefix(KurrentClient client) {
#region event-type-prefix
var filterOptions = new SubscriptionFilterOptions(EventTypeFilter.Prefix("customer-"));
@@ -80,7 +80,7 @@ static async Task EventTypePrefix(EventStoreClient client) {
}
}
-static async Task EventTypeRegex(EventStoreClient client) {
+static async Task EventTypeRegex(KurrentClient client) {
#region event-type-regex
var filterOptions = new SubscriptionFilterOptions(EventTypeFilter.RegularExpression("^user|^company"));
@@ -97,7 +97,7 @@ static async Task EventTypeRegex(EventStoreClient client) {
}
}
-static async Task StreamPrefix(EventStoreClient client) {
+static async Task StreamPrefix(KurrentClient client) {
#region stream-prefix
var filterOptions = new SubscriptionFilterOptions(StreamFilter.Prefix("user-"));
@@ -114,7 +114,7 @@ static async Task StreamPrefix(EventStoreClient client) {
}
}
-static async Task StreamRegex(EventStoreClient client) {
+static async Task StreamRegex(KurrentClient client) {
#region stream-regex
var filterOptions = new SubscriptionFilterOptions(StreamFilter.RegularExpression("^account|^savings"));
@@ -131,7 +131,7 @@ static async Task StreamRegex(EventStoreClient client) {
}
}
-static async Task CheckpointCallback(EventStoreClient client) {
+static async Task CheckpointCallback(KurrentClient client) {
#region checkpoint
var filterOptions = new SubscriptionFilterOptions(EventTypeFilter.ExcludeSystemEvents());
@@ -151,7 +151,7 @@ static async Task CheckpointCallback(EventStoreClient client) {
#endregion checkpoint
}
-static async Task CheckpointCallbackWithInterval(EventStoreClient client) {
+static async Task CheckpointCallbackWithInterval(KurrentClient client) {
#region checkpoint-with-interval
var filterOptions = new SubscriptionFilterOptions(EventTypeFilter.ExcludeSystemEvents(), 1000);
diff --git a/samples/server-side-filtering/server-side-filtering.csproj b/samples/server-side-filtering/server-side-filtering.csproj
index b69b90670..f3a5ffc58 100644
--- a/samples/server-side-filtering/server-side-filtering.csproj
+++ b/samples/server-side-filtering/server-side-filtering.csproj
@@ -2,11 +2,7 @@
server_side_filtering
-
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/samples/setting-up-dependency-injection/Controllers/EventStoreController.cs b/samples/setting-up-dependency-injection/Controllers/EventStoreController.cs
index d4c3f4d59..f66c237ce 100644
--- a/samples/setting-up-dependency-injection/Controllers/EventStoreController.cs
+++ b/samples/setting-up-dependency-injection/Controllers/EventStoreController.cs
@@ -5,15 +5,15 @@ namespace setting_up_dependency_injection.Controllers {
[Route("[controller]")]
public class EventStoreController : ControllerBase {
#region using-dependency
- private readonly EventStoreClient _eventStoreClient;
+ private readonly KurrentClient _KurrentClient;
- public EventStoreController(EventStoreClient eventStoreClient) {
- _eventStoreClient = eventStoreClient;
+ public EventStoreController(KurrentClient KurrentClient) {
+ _KurrentClient = KurrentClient;
}
[HttpGet]
public IAsyncEnumerable Get() {
- return _eventStoreClient.ReadAllAsync(Direction.Forwards, Position.Start);
+ return _KurrentClient.ReadAllAsync(Direction.Forwards, Position.Start);
}
#endregion using-dependency
}
diff --git a/samples/setting-up-dependency-injection/Startup.cs b/samples/setting-up-dependency-injection/Startup.cs
index a1d618aff..cb8c9fb94 100644
--- a/samples/setting-up-dependency-injection/Startup.cs
+++ b/samples/setting-up-dependency-injection/Startup.cs
@@ -10,7 +10,7 @@ public void ConfigureServices(IServiceCollection services) {
#region setting-up-dependency
- services.AddEventStoreClient("esdb://admin:changeit@localhost:2113?tls=false");
+ services.AddKurrentClient("esdb://admin:changeit@localhost:2113?tls=false");
#endregion setting-up-dependency
}
@@ -22,4 +22,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
app.UseRouting();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
-}
\ No newline at end of file
+}
diff --git a/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj b/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj
index 0e2adfd05..e4f581a89 100644
--- a/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj
+++ b/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj
@@ -4,9 +4,6 @@
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/samples/subscribing-to-streams/Program.cs b/samples/subscribing-to-streams/Program.cs
index 90fa29737..01990a17e 100644
--- a/samples/subscribing-to-streams/Program.cs
+++ b/samples/subscribing-to-streams/Program.cs
@@ -3,7 +3,7 @@
// ReSharper disable UnusedParameter.Local
// ReSharper disable UnusedVariable
-await using var client = new EventStoreClient(EventStoreClientSettings.Create("esdb://localhost:2113?tls=false"));
+await using var client = new KurrentClient(KurrentClientSettings.Create("esdb://localhost:2113?tls=false"));
await Task.WhenAll(YieldSamples().Select(async sample => {
try {
@@ -27,7 +27,7 @@ IEnumerable YieldSamples() {
yield return OverridingUserCredentials(client, GetCT());
}
-static async Task SubscribeToStreamFromPosition(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToStreamFromPosition(KurrentClient client, CancellationToken ct) {
#region subscribe-to-stream-from-position
await using var subscription = client.SubscribeToStream(
@@ -46,7 +46,7 @@ static async Task SubscribeToStreamFromPosition(EventStoreClient client, Cancell
#endregion subscribe-to-stream-from-position
}
-static async Task SubscribeToStreamLive(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToStreamLive(KurrentClient client, CancellationToken ct) {
#region subscribe-to-stream-live
await using var subscription = client.SubscribeToStream(
@@ -65,7 +65,7 @@ static async Task SubscribeToStreamLive(EventStoreClient client, CancellationTok
#endregion subscribe-to-stream-live
}
-static async Task SubscribeToStreamResolvingLinkTos(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToStreamResolvingLinkTos(KurrentClient client, CancellationToken ct) {
#region subscribe-to-stream-resolving-linktos
await using var subscription = client.SubscribeToStream(
@@ -85,7 +85,7 @@ static async Task SubscribeToStreamResolvingLinkTos(EventStoreClient client, Can
#endregion subscribe-to-stream-resolving-linktos
}
-static async Task SubscribeToStreamSubscriptionDropped(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToStreamSubscriptionDropped(KurrentClient client, CancellationToken ct) {
#region subscribe-to-stream-subscription-dropped
var checkpoint = await ReadStreamCheckpointAsync() switch {
@@ -120,7 +120,7 @@ static async Task SubscribeToStreamSubscriptionDropped(EventStoreClient client,
#endregion subscribe-to-stream-subscription-dropped
}
-static async Task SubscribeToStream(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToStream(KurrentClient client, CancellationToken ct) {
#region subscribe-to-stream
await using var subscription = client.SubscribeToStream(
@@ -139,7 +139,7 @@ static async Task SubscribeToStream(EventStoreClient client, CancellationToken c
#endregion subscribe-to-stream
}
-static async Task SubscribeToAll(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToAll(KurrentClient client, CancellationToken ct) {
#region subscribe-to-all
await using var subscription = client.SubscribeToAll(
@@ -157,7 +157,7 @@ static async Task SubscribeToAll(EventStoreClient client, CancellationToken ct)
#endregion subscribe-to-all
}
-static async Task SubscribeToAllFromPosition(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToAllFromPosition(KurrentClient client, CancellationToken ct) {
#region subscribe-to-all-from-position
var result = await client.AppendToStreamAsync(
@@ -182,7 +182,7 @@ static async Task SubscribeToAllFromPosition(EventStoreClient client, Cancellati
#endregion subscribe-to-all-from-position
}
-static async Task SubscribeToAllLive(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToAllLive(KurrentClient client, CancellationToken ct) {
#region subscribe-to-all-live
var subscription = client.SubscribeToAll(
@@ -200,7 +200,7 @@ static async Task SubscribeToAllLive(EventStoreClient client, CancellationToken
#endregion subscribe-to-all-live
}
-static async Task SubscribeToAllSubscriptionDropped(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToAllSubscriptionDropped(KurrentClient client, CancellationToken ct) {
#region subscribe-to-all-subscription-dropped
var checkpoint = await ReadCheckpointAsync() switch {
@@ -237,7 +237,7 @@ static async Task SubscribeToAllSubscriptionDropped(EventStoreClient client, Can
#endregion subscribe-to-all-subscription-dropped
}
-static async Task SubscribeToFiltered(EventStoreClient client, CancellationToken ct) {
+static async Task SubscribeToFiltered(KurrentClient client, CancellationToken ct) {
#region stream-prefix-filtered-subscription
var prefixStreamFilter = new SubscriptionFilterOptions(StreamFilter.Prefix("test-", "other-"));
@@ -267,7 +267,7 @@ static async Task SubscribeToFiltered(EventStoreClient client, CancellationToken
#endregion stream-regex-filtered-subscription
}
-static async Task OverridingUserCredentials(EventStoreClient client, CancellationToken ct) {
+static async Task OverridingUserCredentials(KurrentClient client, CancellationToken ct) {
#region overriding-user-credentials
await using var subscription = client.SubscribeToAll(
diff --git a/samples/subscribing-to-streams/subscribing-to-streams.csproj b/samples/subscribing-to-streams/subscribing-to-streams.csproj
index 397f07197..83a740e45 100644
--- a/samples/subscribing-to-streams/subscribing-to-streams.csproj
+++ b/samples/subscribing-to-streams/subscribing-to-streams.csproj
@@ -2,11 +2,7 @@
subscribing_to_streams
-
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/samples/user-certificates/Program.cs b/samples/user-certificates/Program.cs
index dddbb1c7f..98f9e882e 100644
--- a/samples/user-certificates/Program.cs
+++ b/samples/user-certificates/Program.cs
@@ -9,11 +9,11 @@ static async Task ClientWithUserCertificates() {
const string userCertFile = "/path/to/user.crt";
const string userKeyFile = "/path/to/user.key";
- var settings = EventStoreClientSettings.Create(
+ var settings = KurrentClientSettings.Create(
$"esdb://localhost:2113/?tls=true&tlsVerifyCert=true&userCertFile={userCertFile}&userKeyFile={userKeyFile}"
);
- await using var client = new EventStoreClient(settings);
+ await using var client = new KurrentClient(settings);
# endregion client-with-user-certificates
} catch (InvalidClientCertificateException) {
diff --git a/samples/user-certificates/user-certificates.csproj b/samples/user-certificates/user-certificates.csproj
index 7eaa70127..14de7d848 100644
--- a/samples/user-certificates/user-certificates.csproj
+++ b/samples/user-certificates/user-certificates.csproj
@@ -9,8 +9,7 @@
-
-
+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 58ec83eff..38e546298 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,36 +1,21 @@
-
-
- EventStore.Client
-
-
-
-
-
-
-
-
- $(MSBuildProjectName.Remove(0,18))
- EventStore.Client.Grpc.$(PackageIdSuffix)
- ../EventStore.Client/Common/protos/$(PackageIdSuffix.ToLower()).proto
+
+ true
+ Kurrent.Client
+ Kurrent.Client
-
-
-
-
-
ouro.png
LICENSE.md
- https://eventstore.com
+ https://kurrent.io
false
- https://eventstore.com/blog/
- eventstore client grpc
- Event Store Ltd
- Copyright 2012-$([System.DateTime]::Today.Year.ToString()) Event Store Ltd
+ https://kurrent.io/blog/
+ kurrent client grpc
+ Kurrent Ltd
+ Copyright 2012-$([System.DateTime]::Today.Year.ToString()) Kurrent Ltd
v
@@ -38,30 +23,27 @@
-
+
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
diff --git a/src/EventStore.Client.Extensions.OpenTelemetry/EventStore.Client.Extensions.OpenTelemetry.csproj b/src/EventStore.Client.Extensions.OpenTelemetry/EventStore.Client.Extensions.OpenTelemetry.csproj
deleted file mode 100644
index e32bbacc7..000000000
--- a/src/EventStore.Client.Extensions.OpenTelemetry/EventStore.Client.Extensions.OpenTelemetry.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- EventStore.Client.Extensions.OpenTelemetry
-
-
-
- EventStore.Client.Extensions.OpenTelemetry
- Extensions used to facilitate instrumentation of the EventStore Client.
-
-
-
-
-
-
-
diff --git a/src/EventStore.Client.Extensions.OpenTelemetry/TracerProviderBuilderExtensions.cs b/src/EventStore.Client.Extensions.OpenTelemetry/TracerProviderBuilderExtensions.cs
deleted file mode 100644
index 6a8b42b96..000000000
--- a/src/EventStore.Client.Extensions.OpenTelemetry/TracerProviderBuilderExtensions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using EventStore.Client.Diagnostics;
-using JetBrains.Annotations;
-using OpenTelemetry.Trace;
-
-namespace EventStore.Client.Extensions.OpenTelemetry;
-
-///
-/// Extension methods used to facilitate tracing instrumentation of the EventStore Client.
-///
-[PublicAPI]
-public static class TracerProviderBuilderExtensions {
- ///
- /// Adds the EventStore client ActivitySource name to the list of subscribed sources on the
- ///
- /// being configured.
- /// The instance of to chain configuration.
- public static TracerProviderBuilder AddEventStoreClientInstrumentation(this TracerProviderBuilder builder) =>
- builder.AddSource(EventStoreClientDiagnostics.InstrumentationName);
-}
\ No newline at end of file
diff --git a/src/EventStore.Client.Operations/EventStore.Client.Operations.csproj b/src/EventStore.Client.Operations/EventStore.Client.Operations.csproj
deleted file mode 100644
index 37299e1a1..000000000
--- a/src/EventStore.Client.Operations/EventStore.Client.Operations.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- The GRPC client API for Event Store Operations, e.g., Scavenging. Get the open source or commercial versions of Event Store server from https://eventstore.com/
-
-
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStore.Client.PersistentSubscriptions.csproj b/src/EventStore.Client.PersistentSubscriptions/EventStore.Client.PersistentSubscriptions.csproj
deleted file mode 100644
index 405a77405..000000000
--- a/src/EventStore.Client.PersistentSubscriptions/EventStore.Client.PersistentSubscriptions.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- The GRPC client API for Event Store Persistent Subscriptions. Get the open source or commercial versions of Event Store server from https://eventstore.com/
-
-
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Read.cs b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Read.cs
deleted file mode 100644
index 211ffdbeb..000000000
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Read.cs
+++ /dev/null
@@ -1,478 +0,0 @@
-using System.Threading.Channels;
-using EventStore.Client.Diagnostics;
-using EventStore.Client.PersistentSubscriptions;
-using Grpc.Core;
-
-using static EventStore.Client.PersistentSubscriptions.PersistentSubscriptions;
-using static EventStore.Client.PersistentSubscriptions.ReadResp.ContentOneofCase;
-
-namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
- ///
- /// Subscribes to a persistent subscription.
- ///
- ///
- ///
- ///
- [Obsolete("SubscribeAsync is no longer supported. Use SubscribeToStream with manual acks instead.", false)]
- public async Task SubscribeAsync(
- string streamName, string groupName,
- Func eventAppeared,
- Action? subscriptionDropped = null,
- UserCredentials? userCredentials = null, int bufferSize = 10, bool autoAck = true,
- CancellationToken cancellationToken = default
- ) {
- if (autoAck) {
- throw new InvalidOperationException(
- $"AutoAck is no longer supported. Please use {nameof(SubscribeToStream)} with manual acks instead."
- );
- }
-
- return await PersistentSubscription
- .Confirm(
- SubscribeToStream(streamName, groupName, bufferSize, userCredentials, cancellationToken),
- eventAppeared,
- subscriptionDropped ?? delegate { },
- _log,
- userCredentials,
- cancellationToken
- )
- .ConfigureAwait(false);
- }
-
- ///
- /// Subscribes to a persistent subscription. Messages must be manually acknowledged
- ///
- ///
- ///
- ///
- public async Task SubscribeToStreamAsync(
- string streamName, string groupName,
- Func eventAppeared,
- Action? subscriptionDropped = null,
- UserCredentials? userCredentials = null, int bufferSize = 10,
- CancellationToken cancellationToken = default
- ) {
- return await PersistentSubscription
- .Confirm(
- SubscribeToStream(streamName, groupName, bufferSize, userCredentials, cancellationToken),
- eventAppeared,
- subscriptionDropped ?? delegate { },
- _log,
- userCredentials,
- cancellationToken
- )
- .ConfigureAwait(false);
- }
-
- ///
- /// Subscribes to a persistent subscription. Messages must be manually acknowledged.
- ///
- /// The name of the stream to read events from.
- /// The name of the persistent subscription group.
- /// The size of the buffer.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public PersistentSubscriptionResult SubscribeToStream(
- string streamName, string groupName, int bufferSize = 10,
- UserCredentials? userCredentials = null, CancellationToken cancellationToken = default
- ) {
- if (streamName == null) {
- throw new ArgumentNullException(nameof(streamName));
- }
-
- if (groupName == null) {
- throw new ArgumentNullException(nameof(groupName));
- }
-
- if (streamName == string.Empty) {
- throw new ArgumentException($"{nameof(streamName)} may not be empty.", nameof(streamName));
- }
-
- if (groupName == string.Empty) {
- throw new ArgumentException($"{nameof(groupName)} may not be empty.", nameof(groupName));
- }
-
- if (bufferSize <= 0) {
- throw new ArgumentOutOfRangeException(nameof(bufferSize));
- }
-
- var readOptions = new ReadReq.Types.Options {
- BufferSize = bufferSize,
- GroupName = groupName,
- UuidOption = new ReadReq.Types.Options.Types.UUIDOption { Structured = new Empty() }
- };
-
- if (streamName == SystemStreams.AllStream) {
- readOptions.All = new Empty();
- } else {
- readOptions.StreamIdentifier = streamName;
- }
-
- return new PersistentSubscriptionResult(
- streamName,
- groupName,
- async ct => {
- var channelInfo = await GetChannelInfo(ct).ConfigureAwait(false);
-
- if (streamName == SystemStreams.AllStream &&
- !channelInfo.ServerCapabilities.SupportsPersistentSubscriptionsToAll) {
- throw new NotSupportedException(
- "The server does not support persistent subscriptions to $all."
- );
- }
-
- return channelInfo;
- },
- new() { Options = readOptions },
- Settings,
- userCredentials,
- cancellationToken
- );
- }
-
- ///
- /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged
- ///
- public async Task SubscribeToAllAsync(
- string groupName,
- Func eventAppeared,
- Action? subscriptionDropped = null,
- UserCredentials? userCredentials = null, int bufferSize = 10,
- CancellationToken cancellationToken = default
- ) =>
- await SubscribeToStreamAsync(
- SystemStreams.AllStream,
- groupName,
- eventAppeared,
- subscriptionDropped,
- userCredentials,
- bufferSize,
- cancellationToken
- )
- .ConfigureAwait(false);
-
- ///
- /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged.
- ///
- /// The name of the persistent subscription group.
- /// The size of the buffer.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public PersistentSubscriptionResult SubscribeToAll(
- string groupName, int bufferSize = 10,
- UserCredentials? userCredentials = null, CancellationToken cancellationToken = default
- ) =>
- SubscribeToStream(SystemStreams.AllStream, groupName, bufferSize, userCredentials, cancellationToken);
-
- ///
- public class PersistentSubscriptionResult : IAsyncEnumerable, IAsyncDisposable, IDisposable {
- const int MaxEventIdLength = 2000;
-
- readonly ReadReq _request;
- readonly Channel _channel;
- readonly CancellationTokenSource _cts;
- readonly CallOptions _callOptions;
-
- AsyncDuplexStreamingCall? _call;
- int _messagesEnumerated;
-
- ///
- /// The server-generated unique identifier for the subscription.
- ///
- public string? SubscriptionId { get; private set; }
-
- ///
- /// The name of the stream to read events from.
- ///
- public string StreamName { get; }
-
- ///
- /// The name of the persistent subscription group.
- ///
- public string GroupName { get; }
-
- ///
- /// An . Do not enumerate more than once.
- ///
- public IAsyncEnumerable Messages {
- get {
- if (Interlocked.Exchange(ref _messagesEnumerated, 1) == 1)
- throw new InvalidOperationException("Messages may only be enumerated once.");
-
- return GetMessages();
-
- async IAsyncEnumerable GetMessages() {
- try {
- await foreach (var message in _channel.Reader.ReadAllAsync(_cts.Token)) {
- if (message is PersistentSubscriptionMessage.SubscriptionConfirmation(var subscriptionId))
- SubscriptionId = subscriptionId;
-
- yield return message;
- }
- }
- finally {
- _cts.Cancel();
- }
- }
- }
- }
-
- internal PersistentSubscriptionResult(
- string streamName, string groupName,
- Func> selectChannelInfo,
- ReadReq request, EventStoreClientSettings settings, UserCredentials? userCredentials,
- CancellationToken cancellationToken
- ) {
- StreamName = streamName;
- GroupName = groupName;
-
- _request = request;
-
- _callOptions = EventStoreCallOptions.CreateStreaming(
- settings,
- userCredentials: userCredentials,
- cancellationToken: cancellationToken
- );
-
- _channel = Channel.CreateBounded(ReadBoundedChannelOptions);
-
- _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
- _ = PumpMessages();
-
- return;
-
- async Task PumpMessages() {
- try {
- var channelInfo = await selectChannelInfo(_cts.Token).ConfigureAwait(false);
- var client = new PersistentSubscriptionsClient(channelInfo.CallInvoker);
-
- _call = client.Read(_callOptions);
-
- await _call.RequestStream.WriteAsync(_request).ConfigureAwait(false);
-
- await foreach (var response in _call.ResponseStream.ReadAllAsync(_cts.Token).ConfigureAwait(false)) {
- PersistentSubscriptionMessage subscriptionMessage = response.ContentCase switch {
- SubscriptionConfirmation => new PersistentSubscriptionMessage.SubscriptionConfirmation(
- response.SubscriptionConfirmation.SubscriptionId
- ),
- Event => new PersistentSubscriptionMessage.Event(
- ConvertToResolvedEvent(response),
- response.Event.CountCase switch {
- ReadResp.Types.ReadEvent.CountOneofCase.RetryCount => response.Event.RetryCount,
- _ => null
- }
- ),
- _ => PersistentSubscriptionMessage.Unknown.Instance
- };
-
- if (subscriptionMessage is PersistentSubscriptionMessage.Event evnt)
- EventStoreClientDiagnostics.ActivitySource.TraceSubscriptionEvent(
- SubscriptionId,
- evnt.ResolvedEvent,
- channelInfo,
- settings,
- userCredentials
- );
-
- await _channel.Writer.WriteAsync(subscriptionMessage, _cts.Token).ConfigureAwait(false);
- }
-
- _channel.Writer.TryComplete();
- } catch (Exception ex) {
-#if NET48
- switch (ex) {
- // The gRPC client for .NET 48 uses WinHttpHandler under the hood for sending HTTP requests.
- // In certain scenarios, this can lead to exceptions of type WinHttpException being thrown.
- // One such scenario is when the server abruptly closes the connection, which results in a WinHttpException with the error code 12030.
- // Additionally, there are cases where the server response does not include the 'grpc-status' header.
- // The absence of this header leads to an RpcException with the status code 'Cancelled' and the message "No grpc-status found on response".
- // The switch statement below handles these specific exceptions and translates them into the appropriate
- // PersistentSubscriptionDroppedByServerException exception.
- case RpcException { StatusCode: StatusCode.Unavailable } rex1 when rex1.Status.Detail.Contains("WinHttpException: Error 12030"):
- case RpcException { StatusCode: StatusCode.Cancelled } rex2
- when rex2.Status.Detail.Contains("No grpc-status found on response"):
- ex = new PersistentSubscriptionDroppedByServerException(StreamName, GroupName, ex);
- break;
- }
-#endif
- if (ex is PersistentSubscriptionNotFoundException) {
- await _channel.Writer
- .WriteAsync(PersistentSubscriptionMessage.NotFound.Instance, cancellationToken)
- .ConfigureAwait(false);
-
- _channel.Writer.TryComplete();
- return;
- }
-
- _channel.Writer.TryComplete(ex);
- }
- }
- }
-
- ///
- /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
- ///
- /// There is no need to ack a message if you have Auto Ack enabled.
- /// The of the s to acknowledge. There should not be more than 2000 to ack at a time.
- public Task Ack(params Uuid[] eventIds) => AckInternal(eventIds);
-
- ///
- /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
- ///
- /// There is no need to ack a message if you have Auto Ack enabled.
- /// The of the s to acknowledge. There should not be more than 2000 to ack at a time.
- public Task Ack(IEnumerable eventIds) => Ack(eventIds.ToArray());
-
- ///
- /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
- ///
- /// There is no need to ack a message if you have Auto Ack enabled.
- /// The s to acknowledge. There should not be more than 2000 to ack at a time.
- public Task Ack(params ResolvedEvent[] resolvedEvents) =>
- Ack(Array.ConvertAll(resolvedEvents, resolvedEvent => resolvedEvent.OriginalEvent.EventId));
-
- ///
- /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
- ///
- /// There is no need to ack a message if you have Auto Ack enabled.
- /// The s to acknowledge. There should not be more than 2000 to ack at a time.
- public Task Ack(IEnumerable resolvedEvents) =>
- Ack(resolvedEvents.Select(resolvedEvent => resolvedEvent.OriginalEvent.EventId));
-
- ///
- /// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
- ///
- /// The to take.
- /// A reason given.
- /// The of the s to nak. There should not be more than 2000 to nak at a time.
- /// The number of eventIds exceeded the limit of 2000.
- public Task Nack(PersistentSubscriptionNakEventAction action, string reason, params Uuid[] eventIds) =>
- NackInternal(eventIds, action, reason);
-
- ///
- /// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
- ///
- /// The to take.
- /// A reason given.
- /// The s to nak. There should not be more than 2000 to nak at a time.
- /// The number of resolvedEvents exceeded the limit of 2000.
- public Task Nack(PersistentSubscriptionNakEventAction action, string reason, params ResolvedEvent[] resolvedEvents) =>
- Nack(action, reason, Array.ConvertAll(resolvedEvents, re => re.OriginalEvent.EventId));
-
- static ResolvedEvent ConvertToResolvedEvent(ReadResp response) => new(
- ConvertToEventRecord(response.Event.Event)!,
- ConvertToEventRecord(response.Event.Link),
- response.Event.PositionCase switch {
- ReadResp.Types.ReadEvent.PositionOneofCase.CommitPosition => response.Event.CommitPosition,
- _ => null
- }
- );
-
- Task AckInternal(params Uuid[] eventIds) {
- if (eventIds.Length > MaxEventIdLength) {
- throw new ArgumentException(
- $"The number of eventIds exceeds the maximum length of {MaxEventIdLength}.",
- nameof(eventIds)
- );
- }
-
- return _call is null
- ? throw new InvalidOperationException()
- : _call.RequestStream.WriteAsync(
- new ReadReq {
- Ack = new ReadReq.Types.Ack {
- Ids = {
- Array.ConvertAll(eventIds, id => id.ToDto())
- }
- }
- }
- );
- }
-
- Task NackInternal(Uuid[] eventIds, PersistentSubscriptionNakEventAction action, string reason) {
- if (eventIds.Length > MaxEventIdLength) {
- throw new ArgumentException(
- $"The number of eventIds exceeds the maximum length of {MaxEventIdLength}.",
- nameof(eventIds)
- );
- }
-
- return _call is null
- ? throw new InvalidOperationException()
- : _call.RequestStream.WriteAsync(
- new ReadReq {
- Nack = new ReadReq.Types.Nack {
- Ids = {
- Array.ConvertAll(eventIds, id => id.ToDto())
- },
- Action = action switch {
- PersistentSubscriptionNakEventAction.Park => ReadReq.Types.Nack.Types.Action.Park,
- PersistentSubscriptionNakEventAction.Retry => ReadReq.Types.Nack.Types.Action.Retry,
- PersistentSubscriptionNakEventAction.Skip => ReadReq.Types.Nack.Types.Action.Skip,
- PersistentSubscriptionNakEventAction.Stop => ReadReq.Types.Nack.Types.Action.Stop,
- _ => ReadReq.Types.Nack.Types.Action.Unknown
- },
- Reason = reason
- }
- }
- );
- }
-
- static EventRecord? ConvertToEventRecord(ReadResp.Types.ReadEvent.Types.RecordedEvent? e) =>
- e is null
- ? null
- : new EventRecord(
- e.StreamIdentifier!,
- Uuid.FromDto(e.Id),
- new StreamPosition(e.StreamRevision),
- new Position(e.CommitPosition, e.PreparePosition),
- e.Metadata,
- e.Data.ToByteArray(),
- e.CustomMetadata.ToByteArray()
- );
-
- ///
- public async ValueTask DisposeAsync() {
- await CastAndDispose(_cts).ConfigureAwait(false);
- await CastAndDispose(_call).ConfigureAwait(false);
-
- return;
-
- static async Task CastAndDispose(IDisposable? resource) {
- switch (resource) {
- case null:
- return;
-
- case IAsyncDisposable resourceAsyncDisposable:
- await resourceAsyncDisposable.DisposeAsync().ConfigureAwait(false);
- break;
-
- default:
- resource.Dispose();
- break;
- }
- }
- }
-
- ///
- public void Dispose() {
- _cts.Dispose();
- _call?.Dispose();
- }
-
- ///
- public async IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) {
- await foreach (var message in Messages.WithCancellation(cancellationToken)) {
- if (message is not PersistentSubscriptionMessage.Event(var resolvedEvent, _))
- continue;
-
- yield return resolvedEvent;
- }
- }
- }
- }
-}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClientCollectionExtensions.cs b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClientCollectionExtensions.cs
deleted file mode 100644
index f8d491dda..000000000
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClientCollectionExtensions.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// ReSharper disable CheckNamespace
-
-using System;
-using System.Net.Http;
-using EventStore.Client;
-using Grpc.Core.Interceptors;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Logging;
-
-namespace Microsoft.Extensions.DependencyInjection {
- ///
- /// A set of extension methods for which provide support for an .
- ///
- public static class EventStorePersistentSubscriptionsClientCollectionExtensions {
- ///
- /// Adds an to the .
- ///
- ///
- public static IServiceCollection AddEventStorePersistentSubscriptionsClient(this IServiceCollection services,
- Uri address, Func? createHttpMessageHandler = null)
- => services.AddEventStorePersistentSubscriptionsClient(options => {
- options.ConnectivitySettings.Address = address;
- options.CreateHttpMessageHandler = createHttpMessageHandler;
- });
-
- ///
- /// Adds an to the .
- ///
- ///
- public static IServiceCollection AddEventStorePersistentSubscriptionsClient(this IServiceCollection services,
- Action? configureSettings = null) =>
- services.AddEventStorePersistentSubscriptionsClient(new EventStoreClientSettings(),
- configureSettings);
-
- ///
- /// Adds an to the .
- ///
- ///
- public static IServiceCollection AddEventStorePersistentSubscriptionsClient(this IServiceCollection services,
- string connectionString, Action? configureSettings = null) =>
- services.AddEventStorePersistentSubscriptionsClient(EventStoreClientSettings.Create(connectionString),
- configureSettings);
-
- private static IServiceCollection AddEventStorePersistentSubscriptionsClient(this IServiceCollection services,
- EventStoreClientSettings settings, Action? configureSettings) {
- if (services == null) {
- throw new ArgumentNullException(nameof(services));
- }
-
- configureSettings?.Invoke(settings);
- services.TryAddSingleton(provider => {
- settings.LoggerFactory ??= provider.GetService();
- settings.Interceptors ??= provider.GetServices();
-
- return new EventStorePersistentSubscriptionsClient(settings);
- });
- return services;
- }
- }
-}
-// ReSharper restore CheckNamespace
diff --git a/src/EventStore.Client.ProjectionManagement/EventStore.Client.ProjectionManagement.csproj b/src/EventStore.Client.ProjectionManagement/EventStore.Client.ProjectionManagement.csproj
deleted file mode 100644
index 678656cff..000000000
--- a/src/EventStore.Client.ProjectionManagement/EventStore.Client.ProjectionManagement.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- The GRPC client API for managing Event Store Projections. Get the open source or commercial versions of Event Store server from https://eventstore.com/
-
-
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.cs b/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.cs
deleted file mode 100644
index be0679928..000000000
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Grpc.Core;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Options;
-
-namespace EventStore.Client {
- ///
- ///The client used to manage projections on the EventStoreDB.
- ///
- public sealed partial class EventStoreProjectionManagementClient : EventStoreClientBase {
- private readonly ILogger _log;
-
- ///
- /// Constructs a new . This method is not intended to be called directly from your code.
- ///
- ///
- public EventStoreProjectionManagementClient(IOptions options) : this(options.Value) {
- }
-
- ///
- /// Constructs a new .
- ///
- ///
- public EventStoreProjectionManagementClient(EventStoreClientSettings? settings) : base(settings,
- new Dictionary>()) {
- _log = settings?.LoggerFactory?.CreateLogger() ??
- new NullLogger();
- }
- }
-}
diff --git a/src/EventStore.Client.Streams/EventStore.Client.Streams.csproj b/src/EventStore.Client.Streams/EventStore.Client.Streams.csproj
deleted file mode 100644
index c878127a5..000000000
--- a/src/EventStore.Client.Streams/EventStore.Client.Streams.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- The GRPC client API for Event Store Streams. Get the open source or commercial versions of Event Store server from https://eventstore.com/
-
-
diff --git a/src/EventStore.Client.Streams/EventStoreClient.Subscriptions.cs b/src/EventStore.Client.Streams/EventStoreClient.Subscriptions.cs
deleted file mode 100644
index 6f3b2f2c6..000000000
--- a/src/EventStore.Client.Streams/EventStoreClient.Subscriptions.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-using System.Threading.Channels;
-using EventStore.Client.Diagnostics;
-using EventStore.Client.Streams;
-using Grpc.Core;
-
-using static EventStore.Client.Streams.ReadResp.ContentOneofCase;
-
-namespace EventStore.Client {
- public partial class EventStoreClient {
- ///
- /// Subscribes to all events.
- ///
- /// A (exclusive of) to start the subscription from.
- /// A Task invoked and awaited when a new event is received over the subscription.
- /// Whether to resolve LinkTo events automatically.
- /// An action invoked if the subscription is dropped.
- /// The optional to apply.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public Task SubscribeToAllAsync(
- FromAll start,
- Func eventAppeared,
- bool resolveLinkTos = false,
- Action? subscriptionDropped = default,
- SubscriptionFilterOptions? filterOptions = null,
- UserCredentials? userCredentials = null,
- CancellationToken cancellationToken = default
- ) => StreamSubscription.Confirm(
- SubscribeToAll(start, resolveLinkTos, filterOptions, userCredentials, cancellationToken),
- eventAppeared,
- subscriptionDropped,
- _log,
- filterOptions?.CheckpointReached,
- cancellationToken: cancellationToken
- );
-
- ///
- /// Subscribes to all events.
- ///
- /// A (exclusive of) to start the subscription from.
- /// Whether to resolve LinkTo events automatically.
- /// The optional to apply.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public StreamSubscriptionResult SubscribeToAll(
- FromAll start,
- bool resolveLinkTos = false,
- SubscriptionFilterOptions? filterOptions = null,
- UserCredentials? userCredentials = null,
- CancellationToken cancellationToken = default
- ) => new(
- async _ => await GetChannelInfo(cancellationToken).ConfigureAwait(false),
- new ReadReq {
- Options = new ReadReq.Types.Options {
- ReadDirection = ReadReq.Types.Options.Types.ReadDirection.Forwards,
- ResolveLinks = resolveLinkTos,
- All = ReadReq.Types.Options.Types.AllOptions.FromSubscriptionPosition(start),
- Subscription = new ReadReq.Types.Options.Types.SubscriptionOptions(),
- Filter = GetFilterOptions(filterOptions)!,
- UuidOption = new() { Structured = new() }
- }
- },
- Settings,
- userCredentials,
- cancellationToken
- );
-
- ///
- /// Subscribes to a stream from a checkpoint.
- ///
- /// A (exclusive of) to start the subscription from.
- /// The name of the stream to read events from.
- /// A Task invoked and awaited when a new event is received over the subscription.
- /// Whether to resolve LinkTo events automatically.
- /// An action invoked if the subscription is dropped.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public Task SubscribeToStreamAsync(
- string streamName,
- FromStream start,
- Func eventAppeared,
- bool resolveLinkTos = false,
- Action? subscriptionDropped = default,
- UserCredentials? userCredentials = null,
- CancellationToken cancellationToken = default
- ) => StreamSubscription.Confirm(
- SubscribeToStream(streamName, start, resolveLinkTos, userCredentials, cancellationToken),
- eventAppeared,
- subscriptionDropped,
- _log,
- cancellationToken: cancellationToken
- );
-
- ///
- /// Subscribes to a stream from a checkpoint.
- ///
- /// A (exclusive of) to start the subscription from.
- /// The name of the stream to read events from.
- /// Whether to resolve LinkTo events automatically.
- /// The optional user credentials to perform operation with.
- /// The optional .
- ///
- public StreamSubscriptionResult SubscribeToStream(
- string streamName,
- FromStream start,
- bool resolveLinkTos = false,
- UserCredentials? userCredentials = null,
- CancellationToken cancellationToken = default
- ) => new(
- async _ => await GetChannelInfo(cancellationToken).ConfigureAwait(false),
- new ReadReq {
- Options = new ReadReq.Types.Options {
- ReadDirection = ReadReq.Types.Options.Types.ReadDirection.Forwards,
- ResolveLinks = resolveLinkTos,
- Stream = ReadReq.Types.Options.Types.StreamOptions.FromSubscriptionPosition(streamName, start),
- Subscription = new ReadReq.Types.Options.Types.SubscriptionOptions(),
- UuidOption = new() { Structured = new() }
- }
- },
- Settings,
- userCredentials,
- cancellationToken
- );
-
- ///
- /// A class that represents the result of a subscription operation. You may either enumerate this instance directly or . Do not enumerate more than once.
- ///
- public class StreamSubscriptionResult : IAsyncEnumerable, IAsyncDisposable, IDisposable {
- private readonly ReadReq _request;
- private readonly Channel _channel;
- private readonly CancellationTokenSource _cts;
- private readonly CallOptions _callOptions;
- private readonly EventStoreClientSettings _settings;
- private AsyncServerStreamingCall? _call;
-
- private int _messagesEnumerated;
-
- ///
- /// The server-generated unique identifier for the subscription.
- ///
- public string? SubscriptionId { get; private set; }
-
- ///
- /// An . Do not enumerate more than once.
- ///
- public IAsyncEnumerable Messages {
- get {
- if (Interlocked.Exchange(ref _messagesEnumerated, 1) == 1)
- throw new InvalidOperationException("Messages may only be enumerated once.");
-
- return GetMessages();
-
- async IAsyncEnumerable GetMessages() {
- try {
- await foreach (var message in _channel.Reader.ReadAllAsync(_cts.Token)) {
- if (message is StreamMessage.SubscriptionConfirmation(var subscriptionId))
- SubscriptionId = subscriptionId;
-
- yield return message;
- }
- }
- finally {
-#if NET8_0_OR_GREATER
- await _cts.CancelAsync().ConfigureAwait(false);
-#else
- _cts.Cancel();
-#endif
- }
- }
- }
- }
-
- internal StreamSubscriptionResult(
- Func> selectChannelInfo,
- ReadReq request, EventStoreClientSettings settings, UserCredentials? userCredentials,
- CancellationToken cancellationToken
- ) {
- _request = request;
- _settings = settings;
-
- _callOptions = EventStoreCallOptions.CreateStreaming(
- settings,
- userCredentials: userCredentials,
- cancellationToken: cancellationToken
- );
-
- _channel = Channel.CreateBounded(ReadBoundedChannelOptions);
-
- _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
- if (_request.Options.FilterOptionCase == ReadReq.Types.Options.FilterOptionOneofCase.None) {
- _request.Options.NoFilter = new();
- }
-
- _ = PumpMessages();
-
- return;
-
- async Task PumpMessages() {
- try {
- var channelInfo = await selectChannelInfo(_cts.Token).ConfigureAwait(false);
- var client = new Streams.Streams.StreamsClient(channelInfo.CallInvoker);
- _call = client.Read(_request, _callOptions);
- await foreach (var response in _call.ResponseStream.ReadAllAsync(_cts.Token).ConfigureAwait(false)) {
- StreamMessage subscriptionMessage =
- response.ContentCase switch {
- Confirmation => new StreamMessage.SubscriptionConfirmation(response.Confirmation.SubscriptionId),
- Event => new StreamMessage.Event(ConvertToResolvedEvent(response.Event)),
- FirstStreamPosition => new StreamMessage.FirstStreamPosition(new StreamPosition(response.FirstStreamPosition)),
- LastStreamPosition => new StreamMessage.LastStreamPosition(new StreamPosition(response.LastStreamPosition)),
- LastAllStreamPosition => new StreamMessage.LastAllStreamPosition(
- new Position(
- response.LastAllStreamPosition.CommitPosition,
- response.LastAllStreamPosition.PreparePosition
- )
- ),
- Checkpoint => new StreamMessage.AllStreamCheckpointReached(
- new Position(
- response.Checkpoint.CommitPosition,
- response.Checkpoint.PreparePosition
- )
- ),
- CaughtUp => StreamMessage.CaughtUp.Instance,
- FellBehind => StreamMessage.FellBehind.Instance,
- _ => StreamMessage.Unknown.Instance
- };
-
- if (subscriptionMessage is StreamMessage.Event evt)
- EventStoreClientDiagnostics.ActivitySource.TraceSubscriptionEvent(
- SubscriptionId,
- evt.ResolvedEvent,
- channelInfo,
- _settings,
- userCredentials
- );
-
- await _channel.Writer
- .WriteAsync(subscriptionMessage, _cts.Token)
- .ConfigureAwait(false);
- }
-
- _channel.Writer.Complete();
- } catch (Exception ex) {
- _channel.Writer.TryComplete(ex);
- }
- }
- }
-
- ///
- public async ValueTask DisposeAsync() {
- //TODO SS: Check if `CastAndDispose` is still relevant
- await CastAndDispose(_cts).ConfigureAwait(false);
- await CastAndDispose(_call).ConfigureAwait(false);
-
- return;
-
- static async ValueTask CastAndDispose(IDisposable? resource) {
- switch (resource) {
- case null:
- return;
-
- case IAsyncDisposable disposable:
- await disposable.DisposeAsync().ConfigureAwait(false);
- break;
-
- default:
- resource.Dispose();
- break;
- }
- }
- }
-
- ///
- public void Dispose() {
- _cts.Dispose();
- _call?.Dispose();
- }
-
- ///
- public async IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) {
- try {
- await foreach (var message in _channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) {
- if (message is not StreamMessage.Event e)
- continue;
-
- yield return e.ResolvedEvent;
- }
- }
- finally {
-#if NET8_0_OR_GREATER
- await _cts.CancelAsync().ConfigureAwait(false);
-#else
- _cts.Cancel();
-#endif
- }
- }
- }
- }
-}
diff --git a/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj b/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj
deleted file mode 100644
index 2c9308e2e..000000000
--- a/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- The GRPC client API for managing users in Event Store. Get the open source or commercial versions of Event Store server from https://eventstore.com/
-
-
-
-
-
diff --git a/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj.DotSettings b/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj.DotSettings
deleted file mode 100644
index 1183b3a73..000000000
--- a/src/EventStore.Client.UserManagement/EventStore.Client.UserManagement.csproj.DotSettings
+++ /dev/null
@@ -1,2 +0,0 @@
-
- True
\ No newline at end of file
diff --git a/src/EventStore.Client/Common/Diagnostics/EventStoreClientDiagnostics.cs b/src/EventStore.Client/Common/Diagnostics/EventStoreClientDiagnostics.cs
deleted file mode 100644
index 6328387ab..000000000
--- a/src/EventStore.Client/Common/Diagnostics/EventStoreClientDiagnostics.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System.Diagnostics;
-
-namespace EventStore.Client.Diagnostics;
-
-public static class EventStoreClientDiagnostics {
- public const string InstrumentationName = "eventstoredb";
- public static readonly ActivitySource ActivitySource = new ActivitySource(InstrumentationName);
-}
\ No newline at end of file
diff --git a/src/EventStore.Client/Common/Diagnostics/Telemetry/TelemetryTags.cs b/src/EventStore.Client/Common/Diagnostics/Telemetry/TelemetryTags.cs
deleted file mode 100644
index ea05d04fa..000000000
--- a/src/EventStore.Client/Common/Diagnostics/Telemetry/TelemetryTags.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// ReSharper disable CheckNamespace
-
-namespace EventStore.Diagnostics.Telemetry;
-
-static partial class TelemetryTags {
- public static class EventStore {
- public const string Stream = "db.eventstoredb.stream";
- public const string SubscriptionId = "db.eventstoredb.subscription.id";
- public const string EventId = "db.eventstoredb.event.id";
- public const string EventType = "db.eventstoredb.event.type";
- }
-}
\ No newline at end of file
diff --git a/src/EventStore.Client/EventStore.Client.csproj b/src/EventStore.Client/EventStore.Client.csproj
deleted file mode 100644
index 47a116602..000000000
--- a/src/EventStore.Client/EventStore.Client.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
- EventStore.Client
- The base GRPC client library for Event Store. Get the open source or commercial versions of Event Store server from https://eventstore.com/
- EventStore.Client.Grpc
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/EventStore.Client/EventStore.Client.csproj.DotSettings b/src/EventStore.Client/EventStore.Client.csproj.DotSettings
deleted file mode 100644
index 9b89548c6..000000000
--- a/src/EventStore.Client/EventStore.Client.csproj.DotSettings
+++ /dev/null
@@ -1,3 +0,0 @@
-
- True
- True
\ No newline at end of file
diff --git a/src/EventStore.Client/Certificates/X509Certificates.cs b/src/Kurrent.Client/Core/Certificates/X509Certificates.cs
similarity index 66%
rename from src/EventStore.Client/Certificates/X509Certificates.cs
rename to src/Kurrent.Client/Core/Certificates/X509Certificates.cs
index 78efda04e..9cda47a08 100644
--- a/src/EventStore.Client/Certificates/X509Certificates.cs
+++ b/src/Kurrent.Client/Core/Certificates/X509Certificates.cs
@@ -2,6 +2,7 @@
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
+#pragma warning disable SYSLIB0057
#if NET48
using Org.BouncyCastle.Crypto;
@@ -13,29 +14,21 @@
namespace EventStore.Client;
static class X509Certificates {
- // TODO SS: Use .NET 8 X509Certificate2.CreateFromPemFile(certPemFilePath, keyPemFilePath) once the Windows32Exception issue is resolved
- public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string keyPemFilePath) {
- try {
- using var publicCert = new X509Certificate2(certPemFilePath);
- using var privateKey = RSA.Create().ImportPrivateKeyFromFile(keyPemFilePath);
- using var certificate = publicCert.CopyWithPrivateKey(privateKey);
-
- return new(certificate.Export(X509ContentType.Pfx));
- }
- catch (Exception ex) {
- throw new CryptographicException($"Failed to load private key: {ex.Message}");
- }
-
- // Notes:
- // using X509Certificate2.CreateFromPemFile(certPemFilePath, keyPemFilePath) would be the ideal choice here,
- // but it's currently causing a Win32Exception specifically on Windows. Alternative implementation is used until the issue is resolved.
- //
- // Error: The SSL connection could not be established, see inner exception. AuthenticationException: Authentication failed because the platform
- // does not support ephemeral keys. Win32Exception: No credentials are available in the security package
- //
- // public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string keyPemFilePath) =>
- // X509Certificate2.CreateFromPemFile(certPemFilePath, keyPemFilePath);
- }
+ public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string keyPemFilePath) {
+ try {
+#if NET8_0_OR_GREATER
+ using var certificate = X509Certificate2.CreateFromPemFile(certPemFilePath, keyPemFilePath);
+#else
+ using var publicCert = new X509Certificate2(certPemFilePath);
+ using var privateKey = RSA.Create().ImportPrivateKeyFromFile(keyPemFilePath);
+ using var certificate = publicCert.CopyWithPrivateKey(privateKey);
+#endif
+
+ return new X509Certificate2(certificate.Export(X509ContentType.Pfx));
+ } catch (Exception ex) {
+ throw new CryptographicException($"Failed to load private key: {ex.Message}");
+ }
+ }
}
public static class RsaExtensions {
@@ -104,4 +97,4 @@ public static string ParseKeyLabel(string pemFileHeader) {
return label;
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/ChannelBaseExtensions.cs b/src/Kurrent.Client/Core/ChannelBaseExtensions.cs
similarity index 99%
rename from src/EventStore.Client/ChannelBaseExtensions.cs
rename to src/Kurrent.Client/Core/ChannelBaseExtensions.cs
index 3edbf59fd..9c44addef 100644
--- a/src/EventStore.Client/ChannelBaseExtensions.cs
+++ b/src/Kurrent.Client/Core/ChannelBaseExtensions.cs
@@ -7,4 +7,4 @@ public static async ValueTask DisposeAsync(this ChannelBase channel) {
await channel.ShutdownAsync().ConfigureAwait(false);
(channel as IDisposable)?.Dispose();
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/ChannelCache.cs b/src/Kurrent.Client/Core/ChannelCache.cs
similarity index 96%
rename from src/EventStore.Client/ChannelCache.cs
rename to src/Kurrent.Client/Core/ChannelCache.cs
index a3369e25f..09f7c2b86 100644
--- a/src/EventStore.Client/ChannelCache.cs
+++ b/src/Kurrent.Client/Core/ChannelCache.cs
@@ -8,13 +8,13 @@ namespace EventStore.Client {
internal class ChannelCache :
IAsyncDisposable {
- private readonly EventStoreClientSettings _settings;
+ private readonly KurrentClientSettings _settings;
private readonly Random _random;
private readonly Dictionary _channels;
private readonly object _lock = new();
private bool _disposed;
- public ChannelCache(EventStoreClientSettings settings) {
+ public ChannelCache(KurrentClientSettings settings) {
_settings = settings;
_random = new Random(0);
_channels = new Dictionary(
diff --git a/src/EventStore.Client/ChannelFactory.cs b/src/Kurrent.Client/Core/ChannelFactory.cs
similarity index 93%
rename from src/EventStore.Client/ChannelFactory.cs
rename to src/Kurrent.Client/Core/ChannelFactory.cs
index 0dc28ee8e..c63605bb4 100644
--- a/src/EventStore.Client/ChannelFactory.cs
+++ b/src/Kurrent.Client/Core/ChannelFactory.cs
@@ -9,7 +9,7 @@ namespace EventStore.Client {
internal static class ChannelFactory {
private const int MaxReceiveMessageLength = 17 * 1024 * 1024;
- public static TChannel CreateChannel(EventStoreClientSettings settings, EndPoint endPoint) {
+ public static TChannel CreateChannel(KurrentClientSettings settings, EndPoint endPoint) {
var address = endPoint.ToUri(!settings.ConnectivitySettings.Insecure);
if (settings.ConnectivitySettings.Insecure) {
@@ -37,7 +37,7 @@ public static TChannel CreateChannel(EventStoreClientSettings settings, EndPoint
#if NET48
- static HttpMessageHandler CreateHandler(EventStoreClientSettings settings) {
+ static HttpMessageHandler CreateHandler(KurrentClientSettings settings) {
if (settings.CreateHttpMessageHandler is not null)
return settings.CreateHttpMessageHandler.Invoke();
@@ -67,7 +67,7 @@ static HttpMessageHandler CreateHandler(EventStoreClientSettings settings) {
return handler;
}
#else
- static HttpMessageHandler CreateHandler(EventStoreClientSettings settings) {
+ static HttpMessageHandler CreateHandler(KurrentClientSettings settings) {
if (settings.CreateHttpMessageHandler is not null)
return settings.CreateHttpMessageHandler.Invoke();
diff --git a/src/EventStore.Client/ChannelInfo.cs b/src/Kurrent.Client/Core/ChannelInfo.cs
similarity index 100%
rename from src/EventStore.Client/ChannelInfo.cs
rename to src/Kurrent.Client/Core/ChannelInfo.cs
diff --git a/src/EventStore.Client/ChannelSelector.cs b/src/Kurrent.Client/Core/ChannelSelector.cs
similarity index 94%
rename from src/EventStore.Client/ChannelSelector.cs
rename to src/Kurrent.Client/Core/ChannelSelector.cs
index 354c0a9f5..af0fa3031 100644
--- a/src/EventStore.Client/ChannelSelector.cs
+++ b/src/Kurrent.Client/Core/ChannelSelector.cs
@@ -8,7 +8,7 @@ internal class ChannelSelector : IChannelSelector {
private readonly IChannelSelector _inner;
public ChannelSelector(
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
ChannelCache channelCache) {
_inner = settings.ConnectivitySettings.IsSingleNode
? new SingleNodeChannelSelector(settings, channelCache)
diff --git a/src/EventStore.Client/ClusterMessage.cs b/src/Kurrent.Client/Core/ClusterMessage.cs
similarity index 100%
rename from src/EventStore.Client/ClusterMessage.cs
rename to src/Kurrent.Client/Core/ClusterMessage.cs
diff --git a/src/EventStore.Client/Common/AsyncStreamReaderExtensions.cs b/src/Kurrent.Client/Core/Common/AsyncStreamReaderExtensions.cs
similarity index 100%
rename from src/EventStore.Client/Common/AsyncStreamReaderExtensions.cs
rename to src/Kurrent.Client/Core/Common/AsyncStreamReaderExtensions.cs
diff --git a/src/EventStore.Client/Common/Constants.cs b/src/Kurrent.Client/Core/Common/Constants.cs
similarity index 100%
rename from src/EventStore.Client/Common/Constants.cs
rename to src/Kurrent.Client/Core/Common/Constants.cs
diff --git a/src/EventStore.Client/Common/Diagnostics/ActivitySourceExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/ActivitySourceExtensions.cs
similarity index 72%
rename from src/EventStore.Client/Common/Diagnostics/ActivitySourceExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/ActivitySourceExtensions.cs
index 71f4372da..ab914d8c9 100644
--- a/src/EventStore.Client/Common/Diagnostics/ActivitySourceExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/ActivitySourceExtensions.cs
@@ -1,9 +1,9 @@
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
using System.Diagnostics;
-using EventStore.Diagnostics;
-using EventStore.Diagnostics.Telemetry;
-using EventStore.Diagnostics.Tracing;
+using Kurrent.Diagnostics;
+using Kurrent.Diagnostics.Telemetry;
+using Kurrent.Diagnostics.Tracing;
namespace EventStore.Client.Diagnostics;
@@ -12,13 +12,8 @@ public static async ValueTask TraceClientOperation(
this ActivitySource source,
Func> tracedOperation,
string operationName,
- Func? tagsFactory = null
+ ActivityTagsCollection? tags = null
) {
- if (source.HasNoActiveListeners())
- return await tracedOperation().ConfigureAwait(false);
-
- var tags = tagsFactory?.Invoke();
-
using var activity = StartActivity(source, operationName, ActivityKind.Client, tags, Activity.Current?.Context);
try {
@@ -36,7 +31,7 @@ public static void TraceSubscriptionEvent(
string? subscriptionId,
ResolvedEvent resolvedEvent,
ChannelInfo channelInfo,
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
UserCredentials? userCredentials
) {
if (source.HasNoActiveListeners() || resolvedEvent.Event is null)
@@ -47,12 +42,12 @@ public static void TraceSubscriptionEvent(
if (parentContext == default(ActivityContext)) return;
var tags = new ActivityTagsCollection()
- .WithRequiredTag(TelemetryTags.EventStore.Stream, resolvedEvent.OriginalEvent.EventStreamId)
- .WithOptionalTag(TelemetryTags.EventStore.SubscriptionId, subscriptionId)
- .WithRequiredTag(TelemetryTags.EventStore.EventId, resolvedEvent.OriginalEvent.EventId.ToString())
- .WithRequiredTag(TelemetryTags.EventStore.EventType, resolvedEvent.OriginalEvent.EventType)
+ .WithRequiredTag(TelemetryTags.Kurrent.Stream, resolvedEvent.OriginalEvent.EventStreamId)
+ .WithOptionalTag(TelemetryTags.Kurrent.SubscriptionId, subscriptionId)
+ .WithRequiredTag(TelemetryTags.Kurrent.EventId, resolvedEvent.OriginalEvent.EventId.ToString())
+ .WithRequiredTag(TelemetryTags.Kurrent.EventType, resolvedEvent.OriginalEvent.EventType)
// Ensure consistent server.address attribute when connecting to cluster via dns discovery
- .WithGrpcChannelServerTags(settings, channelInfo)
+ .WithGrpcChannelServerTags(channelInfo)
.WithClientSettingsServerTags(settings)
.WithOptionalTag(
TelemetryTags.Database.User,
@@ -72,7 +67,7 @@ public static void TraceSubscriptionEvent(
return null;
(tags ??= new ActivityTagsCollection())
- .WithRequiredTag(TelemetryTags.Database.System, "eventstoredb")
+ .WithRequiredTag(TelemetryTags.Database.System, "kurrent")
.WithRequiredTag(TelemetryTags.Database.Operation, operationName);
return source
diff --git a/src/EventStore.Client/Common/Diagnostics/ActivityTagsCollectionExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/ActivityTagsCollectionExtensions.cs
similarity index 51%
rename from src/EventStore.Client/Common/Diagnostics/ActivityTagsCollectionExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/ActivityTagsCollectionExtensions.cs
index bc3c2aa75..fd6ad661a 100644
--- a/src/EventStore.Client/Common/Diagnostics/ActivityTagsCollectionExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/ActivityTagsCollectionExtensions.cs
@@ -1,30 +1,25 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
-using EventStore.Diagnostics;
-using EventStore.Diagnostics.Telemetry;
+using Kurrent.Diagnostics;
+using Kurrent.Diagnostics.Telemetry;
namespace EventStore.Client.Diagnostics;
static class ActivityTagsCollectionExtensions {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ActivityTagsCollection WithGrpcChannelServerTags(this ActivityTagsCollection tags, EventStoreClientSettings settings, ChannelInfo? channelInfo) {
+ public static ActivityTagsCollection WithGrpcChannelServerTags(this ActivityTagsCollection tags, ChannelInfo? channelInfo) {
if (channelInfo is null)
return tags;
+
+ var authorityParts = channelInfo.Channel.Target.Split(':');
- var authorityParts = channelInfo.Channel.Target.Split([':'], StringSplitOptions.RemoveEmptyEntries);
-
- string host = authorityParts[0];
- int port = authorityParts.Length == 1
- ? settings.ConnectivitySettings.Insecure ? 80 : 443
- : int.Parse(authorityParts[1]);
-
- return tags
- .WithRequiredTag(TelemetryTags.Server.Address, host)
- .WithRequiredTag(TelemetryTags.Server.Port, port);
- }
+ return tags
+ .WithRequiredTag(TelemetryTags.Server.Address, authorityParts[0])
+ .WithRequiredTag(TelemetryTags.Server.Port, int.Parse(authorityParts[1]));
+ }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ActivityTagsCollection WithClientSettingsServerTags(this ActivityTagsCollection source, EventStoreClientSettings settings) {
+ public static ActivityTagsCollection WithClientSettingsServerTags(this ActivityTagsCollection source, KurrentClientSettings settings) {
if (settings.ConnectivitySettings.DnsGossipSeeds?.Length != 1)
return source;
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/ActivityExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityExtensions.cs
similarity index 94%
rename from src/EventStore.Client/Common/Diagnostics/Core/ActivityExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityExtensions.cs
index 4594d1000..4b6404f60 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/ActivityExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityExtensions.cs
@@ -2,10 +2,10 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
-using EventStore.Diagnostics.Telemetry;
-using EventStore.Diagnostics.Tracing;
+using Kurrent.Diagnostics.Telemetry;
+using Kurrent.Diagnostics.Tracing;
-namespace EventStore.Diagnostics;
+namespace Kurrent.Diagnostics;
static class ActivityExtensions {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -49,4 +49,4 @@ static Activity SetActivityStatus(this Activity activity, ActivityStatus status)
return activity.IsAllDataRequested ? activity.RecordException(status.Exception) : activity;
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/ActivityStatus.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatus.cs
similarity index 93%
rename from src/EventStore.Client/Common/Diagnostics/Core/ActivityStatus.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatus.cs
index a25b7326f..bab790b6c 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/ActivityStatus.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatus.cs
@@ -2,7 +2,7 @@
using System.Diagnostics;
-namespace EventStore.Diagnostics;
+namespace Kurrent.Diagnostics;
record ActivityStatus(ActivityStatusCode StatusCode, string? Description, Exception? Exception) {
public static ActivityStatus Ok(string? description = null) =>
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs
similarity index 95%
rename from src/EventStore.Client/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs
index 77810aa6c..592501d11 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityStatusCodeHelper.cs
@@ -6,7 +6,7 @@
using static System.Diagnostics.ActivityStatusCode;
using static System.StringComparison;
-namespace EventStore.Diagnostics;
+namespace Kurrent.Diagnostics;
static class ActivityStatusCodeHelper {
public const string UnsetStatusCodeTagValue = "UNSET";
@@ -21,4 +21,4 @@ static class ActivityStatusCodeHelper {
Ok => OkStatusCodeTagValue,
_ => null
};
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs
similarity index 97%
rename from src/EventStore.Client/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs
index 15aa0662e..2c8c8b291 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ActivityTagsCollectionExtensions.cs
@@ -3,7 +3,7 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
-namespace EventStore.Diagnostics;
+namespace Kurrent.Diagnostics;
static class ActivityTagsCollectionExtensions {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/ExceptionExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ExceptionExtensions.cs
similarity index 95%
rename from src/EventStore.Client/Common/Diagnostics/Core/ExceptionExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/ExceptionExtensions.cs
index 8403c3c01..7eb397251 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/ExceptionExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/ExceptionExtensions.cs
@@ -2,7 +2,7 @@
using System.Globalization;
-namespace EventStore.Diagnostics;
+namespace Kurrent.Diagnostics;
static class ExceptionExtensions {
///
@@ -22,4 +22,4 @@ public static string ToInvariantString(this Exception exception) {
Thread.CurrentThread.CurrentUICulture = originalUiCulture;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs
similarity index 97%
rename from src/EventStore.Client/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs
index f7d5e4b17..54487e3bd 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Telemetry/TelemetryTags.cs
@@ -1,6 +1,6 @@
// ReSharper disable CheckNamespace
-namespace EventStore.Diagnostics.Telemetry;
+namespace Kurrent.Diagnostics.Telemetry;
// The attributes below match the specification of v1.24.0 of the Open Telemetry semantic conventions.
// Some attributes are ignored where not required or relevant.
@@ -32,4 +32,4 @@ public static class Otel {
public const string StatusCode = "otel.status_code";
public const string StatusDescription = "otel.status_description";
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingConstants.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingConstants.cs
similarity index 83%
rename from src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingConstants.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingConstants.cs
index 26aa2be21..1e94c9ef0 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingConstants.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingConstants.cs
@@ -1,10 +1,10 @@
// ReSharper disable CheckNamespace
-namespace EventStore.Diagnostics.Tracing;
+namespace Kurrent.Diagnostics.Tracing;
static partial class TracingConstants {
public static class Metadata {
public const string TraceId = "$traceId";
public const string SpanId = "$spanId";
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingMetadata.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingMetadata.cs
similarity index 95%
rename from src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingMetadata.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingMetadata.cs
index ecb9c68c6..7580753a7 100644
--- a/src/EventStore.Client/Common/Diagnostics/Core/Tracing/TracingMetadata.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Core/Tracing/TracingMetadata.cs
@@ -3,7 +3,7 @@
using System.Diagnostics;
using System.Text.Json.Serialization;
-namespace EventStore.Diagnostics.Tracing;
+namespace Kurrent.Diagnostics.Tracing;
readonly record struct TracingMetadata(
[property: JsonPropertyName(TracingConstants.Metadata.TraceId)]
diff --git a/src/EventStore.Client/Common/Diagnostics/EventMetadataExtensions.cs b/src/Kurrent.Client/Core/Common/Diagnostics/EventMetadataExtensions.cs
similarity index 97%
rename from src/EventStore.Client/Common/Diagnostics/EventMetadataExtensions.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/EventMetadataExtensions.cs
index 4245d5bb7..d45b53156 100644
--- a/src/EventStore.Client/Common/Diagnostics/EventMetadataExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/EventMetadataExtensions.cs
@@ -1,8 +1,8 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text.Json;
-using EventStore.Diagnostics;
-using EventStore.Diagnostics.Tracing;
+using Kurrent.Diagnostics;
+using Kurrent.Diagnostics.Tracing;
namespace EventStore.Client.Diagnostics;
diff --git a/src/Kurrent.Client/Core/Common/Diagnostics/KurrentClientDiagnostics.cs b/src/Kurrent.Client/Core/Common/Diagnostics/KurrentClientDiagnostics.cs
new file mode 100644
index 000000000..48e437463
--- /dev/null
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/KurrentClientDiagnostics.cs
@@ -0,0 +1,8 @@
+using System.Diagnostics;
+
+namespace EventStore.Client.Diagnostics;
+
+public static class KurrentClientDiagnostics {
+ public const string InstrumentationName = "kurrent";
+ public static readonly ActivitySource ActivitySource = new(InstrumentationName);
+}
diff --git a/src/Kurrent.Client/Core/Common/Diagnostics/Telemetry/TelemetryTags.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Telemetry/TelemetryTags.cs
new file mode 100644
index 000000000..e4e0b11f9
--- /dev/null
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Telemetry/TelemetryTags.cs
@@ -0,0 +1,12 @@
+// ReSharper disable CheckNamespace
+
+namespace Kurrent.Diagnostics.Telemetry;
+
+static partial class TelemetryTags {
+ public static class Kurrent {
+ public const string Stream = "db.kurrent.stream";
+ public const string SubscriptionId = "db.kurrent.subscription.id";
+ public const string EventId = "db.kurrent.event.id";
+ public const string EventType = "db.kurrent.event.type";
+ }
+}
diff --git a/src/EventStore.Client/Common/Diagnostics/Tracing/TracingConstants.cs b/src/Kurrent.Client/Core/Common/Diagnostics/Tracing/TracingConstants.cs
similarity index 85%
rename from src/EventStore.Client/Common/Diagnostics/Tracing/TracingConstants.cs
rename to src/Kurrent.Client/Core/Common/Diagnostics/Tracing/TracingConstants.cs
index e43102ebe..357654570 100644
--- a/src/EventStore.Client/Common/Diagnostics/Tracing/TracingConstants.cs
+++ b/src/Kurrent.Client/Core/Common/Diagnostics/Tracing/TracingConstants.cs
@@ -1,10 +1,10 @@
// ReSharper disable CheckNamespace
-namespace EventStore.Diagnostics.Tracing;
+namespace Kurrent.Diagnostics.Tracing;
static partial class TracingConstants {
public static class Operations {
public const string Append = "streams.append";
public const string Subscribe = "streams.subscribe";
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/EnumerableTaskExtensions.cs b/src/Kurrent.Client/Core/Common/EnumerableTaskExtensions.cs
similarity index 99%
rename from src/EventStore.Client/Common/EnumerableTaskExtensions.cs
rename to src/Kurrent.Client/Core/Common/EnumerableTaskExtensions.cs
index eb4517006..5be066ab5 100644
--- a/src/EventStore.Client/Common/EnumerableTaskExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/EnumerableTaskExtensions.cs
@@ -8,4 +8,4 @@ static class EnumerableTaskExtensions {
[DebuggerStepThrough]
public static Task WhenAll(this IEnumerable> source) => Task.WhenAll(source);
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/EpochExtensions.cs b/src/Kurrent.Client/Core/Common/EpochExtensions.cs
similarity index 99%
rename from src/EventStore.Client/Common/EpochExtensions.cs
rename to src/Kurrent.Client/Core/Common/EpochExtensions.cs
index db59e620d..0643bcecb 100644
--- a/src/EventStore.Client/Common/EpochExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/EpochExtensions.cs
@@ -22,4 +22,4 @@ static class EpochExtensions {
public static DateTime FromTicksSinceEpoch(this long value) => new(UnixEpoch.Ticks + value, DateTimeKind.Utc);
public static long ToTicksSinceEpoch(this DateTime value) => (value - UnixEpoch).Ticks;
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/EventStoreCallOptions.cs b/src/Kurrent.Client/Core/Common/KurrentCallOptions.cs
similarity index 89%
rename from src/EventStore.Client/Common/EventStoreCallOptions.cs
rename to src/Kurrent.Client/Core/Common/KurrentCallOptions.cs
index e6058a170..0644cffea 100644
--- a/src/EventStore.Client/Common/EventStoreCallOptions.cs
+++ b/src/Kurrent.Client/Core/Common/KurrentCallOptions.cs
@@ -3,10 +3,10 @@
namespace EventStore.Client;
-static class EventStoreCallOptions {
+static class KurrentCallOptions {
// deadline falls back to infinity
public static CallOptions CreateStreaming(
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
TimeSpan? deadline = null, UserCredentials? userCredentials = null,
CancellationToken cancellationToken = default
) =>
@@ -14,7 +14,7 @@ public static CallOptions CreateStreaming(
// deadline falls back to connection DefaultDeadline
public static CallOptions CreateNonStreaming(
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
CancellationToken cancellationToken
) =>
Create(
@@ -25,7 +25,7 @@ CancellationToken cancellationToken
);
public static CallOptions CreateNonStreaming(
- EventStoreClientSettings settings, TimeSpan? deadline,
+ KurrentClientSettings settings, TimeSpan? deadline,
UserCredentials? userCredentials, CancellationToken cancellationToken
) =>
Create(
@@ -36,7 +36,7 @@ public static CallOptions CreateNonStreaming(
);
static CallOptions Create(
- EventStoreClientSettings settings, TimeSpan? deadline,
+ KurrentClientSettings settings, TimeSpan? deadline,
UserCredentials? userCredentials, CancellationToken cancellationToken
) =>
new(
@@ -71,4 +71,4 @@ static CallOptions Create(
: timeoutAfter.Value == TimeSpan.MaxValue || timeoutAfter.Value == InfiniteTimeSpan
? DateTime.MaxValue
: DateTime.UtcNow.Add(timeoutAfter.Value);
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/MetadataExtensions.cs b/src/Kurrent.Client/Core/Common/MetadataExtensions.cs
similarity index 99%
rename from src/EventStore.Client/Common/MetadataExtensions.cs
rename to src/Kurrent.Client/Core/Common/MetadataExtensions.cs
index e547970fd..e7311c37f 100644
--- a/src/EventStore.Client/Common/MetadataExtensions.cs
+++ b/src/Kurrent.Client/Core/Common/MetadataExtensions.cs
@@ -26,4 +26,4 @@ public static int GetIntValueOrDefault(this Metadata metadata, string key) =>
metadata.TryGetValue(key, out var s) && int.TryParse(s, out var value)
? value
: default;
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Common/Shims/Index.cs b/src/Kurrent.Client/Core/Common/Shims/Index.cs
similarity index 100%
rename from src/EventStore.Client/Common/Shims/Index.cs
rename to src/Kurrent.Client/Core/Common/Shims/Index.cs
diff --git a/src/EventStore.Client/Common/Shims/IsExternalInit.cs b/src/Kurrent.Client/Core/Common/Shims/IsExternalInit.cs
similarity index 100%
rename from src/EventStore.Client/Common/Shims/IsExternalInit.cs
rename to src/Kurrent.Client/Core/Common/Shims/IsExternalInit.cs
diff --git a/src/EventStore.Client/Common/Shims/Range.cs b/src/Kurrent.Client/Core/Common/Shims/Range.cs
similarity index 100%
rename from src/EventStore.Client/Common/Shims/Range.cs
rename to src/Kurrent.Client/Core/Common/Shims/Range.cs
diff --git a/src/EventStore.Client/Common/Shims/TaskCompletionSource.cs b/src/Kurrent.Client/Core/Common/Shims/TaskCompletionSource.cs
similarity index 100%
rename from src/EventStore.Client/Common/Shims/TaskCompletionSource.cs
rename to src/Kurrent.Client/Core/Common/Shims/TaskCompletionSource.cs
diff --git a/src/EventStore.Client/DefaultRequestVersionHandler.cs b/src/Kurrent.Client/Core/DefaultRequestVersionHandler.cs
similarity index 100%
rename from src/EventStore.Client/DefaultRequestVersionHandler.cs
rename to src/Kurrent.Client/Core/DefaultRequestVersionHandler.cs
diff --git a/src/EventStore.Client/EndPointExtensions.cs b/src/Kurrent.Client/Core/EndPointExtensions.cs
similarity index 100%
rename from src/EventStore.Client/EndPointExtensions.cs
rename to src/Kurrent.Client/Core/EndPointExtensions.cs
diff --git a/src/EventStore.Client/EventData.cs b/src/Kurrent.Client/Core/EventData.cs
similarity index 100%
rename from src/EventStore.Client/EventData.cs
rename to src/Kurrent.Client/Core/EventData.cs
diff --git a/src/EventStore.Client/EventRecord.cs b/src/Kurrent.Client/Core/EventRecord.cs
similarity index 97%
rename from src/EventStore.Client/EventRecord.cs
rename to src/Kurrent.Client/Core/EventRecord.cs
index 67a7b04cf..531362661 100644
--- a/src/EventStore.Client/EventRecord.cs
+++ b/src/Kurrent.Client/Core/EventRecord.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections.Generic;
-
namespace EventStore.Client {
///
/// Represents a previously written event.
diff --git a/src/EventStore.Client/EventTypeFilter.cs b/src/Kurrent.Client/Core/EventTypeFilter.cs
similarity index 100%
rename from src/EventStore.Client/EventTypeFilter.cs
rename to src/Kurrent.Client/Core/EventTypeFilter.cs
diff --git a/src/EventStore.Client/Exceptions/AccessDeniedException.cs b/src/Kurrent.Client/Core/Exceptions/AccessDeniedException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/AccessDeniedException.cs
rename to src/Kurrent.Client/Core/Exceptions/AccessDeniedException.cs
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/ConnectionStringParseException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/ConnectionStringParseException.cs
similarity index 85%
rename from src/EventStore.Client/Exceptions/ConnectionString/ConnectionStringParseException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/ConnectionStringParseException.cs
index cb79f161d..2cb8c1ac5 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/ConnectionStringParseException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/ConnectionStringParseException.cs
@@ -2,7 +2,7 @@
namespace EventStore.Client {
///
- /// The base exception that is thrown when an EventStoreDB connection string could not be parsed.
+ /// The base exception that is thrown when an KurrentDB connection string could not be parsed.
///
public class ConnectionStringParseException : Exception {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/DuplicateKeyException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/DuplicateKeyException.cs
similarity index 77%
rename from src/EventStore.Client/Exceptions/ConnectionString/DuplicateKeyException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/DuplicateKeyException.cs
index 4027d08e8..5cc3c3812 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/DuplicateKeyException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/DuplicateKeyException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when a key in the EventStoreDB connection string is duplicated.
+ /// The exception that is thrown when a key in the KurrentDB connection string is duplicated.
///
public class DuplicateKeyException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidClientCertificateException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidClientCertificateException.cs
similarity index 90%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidClientCertificateException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidClientCertificateException.cs
index 8415742f8..1caf9f9fb 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidClientCertificateException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidClientCertificateException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when a certificate is invalid or not found in the EventStoreDB connection string.
+ /// The exception that is thrown when a certificate is invalid or not found in the KurrentDB connection string.
///
public class InvalidClientCertificateException : ConnectionStringParseException {
///
@@ -11,4 +11,4 @@ public class InvalidClientCertificateException : ConnectionStringParseException
public InvalidClientCertificateException(string message, Exception? innerException = null)
: base(message, innerException) { }
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidHostException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidHostException.cs
similarity index 91%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidHostException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidHostException.cs
index 27ba8f615..696a81c32 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidHostException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidHostException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when there is an invalid host in the EventStoreDB connection string.
+ /// The exception that is thrown when there is an invalid host in the KurrentDB connection string.
///
public class InvalidHostException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidKeyValuePairException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidKeyValuePairException.cs
similarity index 90%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidKeyValuePairException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidKeyValuePairException.cs
index 2e6fc58df..d00e08445 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidKeyValuePairException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidKeyValuePairException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when an invalid key value pair is found in an EventStoreDB connection string.
+ /// The exception that is thrown when an invalid key value pair is found in an KurrentDB connection string.
///
public class InvalidKeyValuePairException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidSchemeException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSchemeException.cs
similarity index 92%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidSchemeException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSchemeException.cs
index 766c13f37..3b5cf2b18 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidSchemeException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSchemeException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when an invalid scheme is defined in the EventStoreDB connection string.
+ /// The exception that is thrown when an invalid scheme is defined in the KurrentDB connection string.
///
public class InvalidSchemeException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidSettingException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSettingException.cs
similarity index 90%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidSettingException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSettingException.cs
index 0bb5da667..71dcc6edc 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidSettingException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidSettingException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when an invalid setting is found in an EventStoreDB connection string.
+ /// The exception that is thrown when an invalid setting is found in an KurrentDB connection string.
///
public class InvalidSettingException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/InvalidUserCredentialsException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidUserCredentialsException.cs
similarity index 86%
rename from src/EventStore.Client/Exceptions/ConnectionString/InvalidUserCredentialsException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidUserCredentialsException.cs
index bd515fee4..1d4544a61 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/InvalidUserCredentialsException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/InvalidUserCredentialsException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when an invalid is specified in the EventStoreDB connection string.
+ /// The exception that is thrown when an invalid is specified in the KurrentDB connection string.
///
public class InvalidUserCredentialsException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/ConnectionString/NoSchemeException.cs b/src/Kurrent.Client/Core/Exceptions/ConnectionString/NoSchemeException.cs
similarity index 90%
rename from src/EventStore.Client/Exceptions/ConnectionString/NoSchemeException.cs
rename to src/Kurrent.Client/Core/Exceptions/ConnectionString/NoSchemeException.cs
index 7551ad467..08432be97 100644
--- a/src/EventStore.Client/Exceptions/ConnectionString/NoSchemeException.cs
+++ b/src/Kurrent.Client/Core/Exceptions/ConnectionString/NoSchemeException.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when no scheme was specified in the EventStoreDB connection string.
+ /// The exception that is thrown when no scheme was specified in the KurrentDB connection string.
///
public class NoSchemeException : ConnectionStringParseException {
///
diff --git a/src/EventStore.Client/Exceptions/DiscoveryException.cs b/src/Kurrent.Client/Core/Exceptions/DiscoveryException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/DiscoveryException.cs
rename to src/Kurrent.Client/Core/Exceptions/DiscoveryException.cs
diff --git a/src/EventStore.Client/Exceptions/NotAuthenticatedException.cs b/src/Kurrent.Client/Core/Exceptions/NotAuthenticatedException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/NotAuthenticatedException.cs
rename to src/Kurrent.Client/Core/Exceptions/NotAuthenticatedException.cs
diff --git a/src/EventStore.Client/Exceptions/NotLeaderException.cs b/src/Kurrent.Client/Core/Exceptions/NotLeaderException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/NotLeaderException.cs
rename to src/Kurrent.Client/Core/Exceptions/NotLeaderException.cs
diff --git a/src/EventStore.Client/Exceptions/RequiredMetadataPropertyMissingException.cs b/src/Kurrent.Client/Core/Exceptions/RequiredMetadataPropertyMissingException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/RequiredMetadataPropertyMissingException.cs
rename to src/Kurrent.Client/Core/Exceptions/RequiredMetadataPropertyMissingException.cs
diff --git a/src/EventStore.Client/Exceptions/ScavengeNotFoundException.cs b/src/Kurrent.Client/Core/Exceptions/ScavengeNotFoundException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/ScavengeNotFoundException.cs
rename to src/Kurrent.Client/Core/Exceptions/ScavengeNotFoundException.cs
diff --git a/src/EventStore.Client/Exceptions/StreamDeletedException.cs b/src/Kurrent.Client/Core/Exceptions/StreamDeletedException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/StreamDeletedException.cs
rename to src/Kurrent.Client/Core/Exceptions/StreamDeletedException.cs
diff --git a/src/EventStore.Client/Exceptions/StreamNotFoundException.cs b/src/Kurrent.Client/Core/Exceptions/StreamNotFoundException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/StreamNotFoundException.cs
rename to src/Kurrent.Client/Core/Exceptions/StreamNotFoundException.cs
diff --git a/src/EventStore.Client/Exceptions/UserNotFoundException.cs b/src/Kurrent.Client/Core/Exceptions/UserNotFoundException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/UserNotFoundException.cs
rename to src/Kurrent.Client/Core/Exceptions/UserNotFoundException.cs
diff --git a/src/EventStore.Client/Exceptions/WrongExpectedVersionException.cs b/src/Kurrent.Client/Core/Exceptions/WrongExpectedVersionException.cs
similarity index 100%
rename from src/EventStore.Client/Exceptions/WrongExpectedVersionException.cs
rename to src/Kurrent.Client/Core/Exceptions/WrongExpectedVersionException.cs
diff --git a/src/EventStore.Client/FromAll.cs b/src/Kurrent.Client/Core/FromAll.cs
similarity index 100%
rename from src/EventStore.Client/FromAll.cs
rename to src/Kurrent.Client/Core/FromAll.cs
diff --git a/src/EventStore.Client/FromStream.cs b/src/Kurrent.Client/Core/FromStream.cs
similarity index 100%
rename from src/EventStore.Client/FromStream.cs
rename to src/Kurrent.Client/Core/FromStream.cs
diff --git a/src/EventStore.Client/GossipChannelSelector.cs b/src/Kurrent.Client/Core/GossipChannelSelector.cs
similarity index 97%
rename from src/EventStore.Client/GossipChannelSelector.cs
rename to src/Kurrent.Client/Core/GossipChannelSelector.cs
index 633ab0d84..5471120b6 100644
--- a/src/EventStore.Client/GossipChannelSelector.cs
+++ b/src/Kurrent.Client/Core/GossipChannelSelector.cs
@@ -10,14 +10,14 @@
namespace EventStore.Client {
// Thread safe
internal class GossipChannelSelector : IChannelSelector {
- private readonly EventStoreClientSettings _settings;
+ private readonly KurrentClientSettings _settings;
private readonly ChannelCache _channels;
private readonly IGossipClient _gossipClient;
private readonly ILogger _log;
private readonly NodeSelector _nodeSelector;
public GossipChannelSelector(
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
ChannelCache channelCache,
IGossipClient gossipClient) {
diff --git a/src/EventStore.Client/GrpcGossipClient.cs b/src/Kurrent.Client/Core/GrpcGossipClient.cs
similarity index 81%
rename from src/EventStore.Client/GrpcGossipClient.cs
rename to src/Kurrent.Client/Core/GrpcGossipClient.cs
index 655d05b5f..5291bfe6c 100644
--- a/src/EventStore.Client/GrpcGossipClient.cs
+++ b/src/Kurrent.Client/Core/GrpcGossipClient.cs
@@ -6,9 +6,9 @@
namespace EventStore.Client {
internal class GrpcGossipClient : IGossipClient {
- private readonly EventStoreClientSettings _settings;
+ private readonly KurrentClientSettings _settings;
- public GrpcGossipClient(EventStoreClientSettings settings) {
+ public GrpcGossipClient(KurrentClientSettings settings) {
_settings = settings;
}
@@ -16,7 +16,7 @@ public GrpcGossipClient(EventStoreClientSettings settings) {
var client = new Gossip.Gossip.GossipClient(channel);
using var call = client.ReadAsync(
new Empty(),
- EventStoreCallOptions.CreateNonStreaming(_settings, ct));
+ KurrentCallOptions.CreateNonStreaming(_settings, ct));
var result = await call.ResponseAsync.ConfigureAwait(false);
return new(result.Members.Select(x =>
diff --git a/src/EventStore.Client/GrpcServerCapabilitiesClient.cs b/src/Kurrent.Client/Core/GrpcServerCapabilitiesClient.cs
similarity index 93%
rename from src/EventStore.Client/GrpcServerCapabilitiesClient.cs
rename to src/Kurrent.Client/Core/GrpcServerCapabilitiesClient.cs
index 02cd41222..1dc29dce0 100644
--- a/src/EventStore.Client/GrpcServerCapabilitiesClient.cs
+++ b/src/Kurrent.Client/Core/GrpcServerCapabilitiesClient.cs
@@ -5,9 +5,9 @@
namespace EventStore.Client {
internal class GrpcServerCapabilitiesClient : IServerCapabilitiesClient {
- private readonly EventStoreClientSettings _settings;
+ private readonly KurrentClientSettings _settings;
- public GrpcServerCapabilitiesClient(EventStoreClientSettings settings) {
+ public GrpcServerCapabilitiesClient(KurrentClientSettings settings) {
_settings = settings;
}
@@ -18,7 +18,7 @@ public async Task GetAsync(
var client = new ServerFeatures.ServerFeatures.ServerFeaturesClient(callInvoker);
using var call = client.GetSupportedMethodsAsync(
new(),
- EventStoreCallOptions.CreateNonStreaming(
+ KurrentCallOptions.CreateNonStreaming(
_settings,
_settings.ConnectivitySettings.GossipTimeout,
null,
@@ -31,7 +31,7 @@ public async Task GetAsync(
var supportsPersistentSubscriptionsRestartSubsystem = false;
var supportsPersistentSubscriptionsReplayParked = false;
var supportsPersistentSubscriptionsList = false;
-
+
var response = await call.ResponseAsync.ConfigureAwait(false);
foreach (var supportedMethod in response.Methods) {
diff --git a/src/EventStore.Client/HashCode.cs b/src/Kurrent.Client/Core/HashCode.cs
similarity index 100%
rename from src/EventStore.Client/HashCode.cs
rename to src/Kurrent.Client/Core/HashCode.cs
diff --git a/src/EventStore.Client/HttpFallback.cs b/src/Kurrent.Client/Core/HttpFallback.cs
similarity index 98%
rename from src/EventStore.Client/HttpFallback.cs
rename to src/Kurrent.Client/Core/HttpFallback.cs
index 3e5420e9a..0f2bfe02d 100644
--- a/src/EventStore.Client/HttpFallback.cs
+++ b/src/Kurrent.Client/Core/HttpFallback.cs
@@ -13,7 +13,7 @@ internal class HttpFallback : IDisposable {
private readonly UserCredentials? _defaultCredentials;
private readonly string _addressScheme;
- internal HttpFallback(EventStoreClientSettings settings) {
+ internal HttpFallback(KurrentClientSettings settings) {
_addressScheme = settings.ConnectivitySettings.ResolvedAddressOrDefault.Scheme;
_defaultCredentials = settings.DefaultCredentials;
diff --git a/src/EventStore.Client/IChannelSelector.cs b/src/Kurrent.Client/Core/IChannelSelector.cs
similarity index 100%
rename from src/EventStore.Client/IChannelSelector.cs
rename to src/Kurrent.Client/Core/IChannelSelector.cs
diff --git a/src/EventStore.Client/IEventFilter.cs b/src/Kurrent.Client/Core/IEventFilter.cs
similarity index 100%
rename from src/EventStore.Client/IEventFilter.cs
rename to src/Kurrent.Client/Core/IEventFilter.cs
diff --git a/src/EventStore.Client/IGossipClient.cs b/src/Kurrent.Client/Core/IGossipClient.cs
similarity index 100%
rename from src/EventStore.Client/IGossipClient.cs
rename to src/Kurrent.Client/Core/IGossipClient.cs
diff --git a/src/EventStore.Client/IPosition.cs b/src/Kurrent.Client/Core/IPosition.cs
similarity index 100%
rename from src/EventStore.Client/IPosition.cs
rename to src/Kurrent.Client/Core/IPosition.cs
diff --git a/src/EventStore.Client/IServerCapabilitiesClient.cs b/src/Kurrent.Client/Core/IServerCapabilitiesClient.cs
similarity index 100%
rename from src/EventStore.Client/IServerCapabilitiesClient.cs
rename to src/Kurrent.Client/Core/IServerCapabilitiesClient.cs
diff --git a/src/EventStore.Client/Interceptors/ConnectionNameInterceptor.cs b/src/Kurrent.Client/Core/Interceptors/ConnectionNameInterceptor.cs
similarity index 100%
rename from src/EventStore.Client/Interceptors/ConnectionNameInterceptor.cs
rename to src/Kurrent.Client/Core/Interceptors/ConnectionNameInterceptor.cs
diff --git a/src/EventStore.Client/Interceptors/ReportLeaderInterceptor.cs b/src/Kurrent.Client/Core/Interceptors/ReportLeaderInterceptor.cs
similarity index 100%
rename from src/EventStore.Client/Interceptors/ReportLeaderInterceptor.cs
rename to src/Kurrent.Client/Core/Interceptors/ReportLeaderInterceptor.cs
diff --git a/src/EventStore.Client/Interceptors/TypedExceptionInterceptor.cs b/src/Kurrent.Client/Core/Interceptors/TypedExceptionInterceptor.cs
similarity index 100%
rename from src/EventStore.Client/Interceptors/TypedExceptionInterceptor.cs
rename to src/Kurrent.Client/Core/Interceptors/TypedExceptionInterceptor.cs
diff --git a/src/EventStore.Client/EventStoreClientBase.cs b/src/Kurrent.Client/Core/KurrentClientBase.cs
similarity index 93%
rename from src/EventStore.Client/EventStoreClientBase.cs
rename to src/Kurrent.Client/Core/KurrentClientBase.cs
index 2b4a5b2f6..923c6f334 100644
--- a/src/EventStore.Client/EventStoreClientBase.cs
+++ b/src/Kurrent.Client/Core/KurrentClientBase.cs
@@ -5,9 +5,9 @@
namespace EventStore.Client {
///
- /// The base class used by clients used to communicate with the EventStoreDB.
+ /// The base class used by clients used to communicate with the KurrentDB.
///
- public abstract class EventStoreClientBase :
+ public abstract class KurrentClientBase :
IDisposable, // for grpc.net we can dispose synchronously, but not for grpc.core
IAsyncDisposable {
private readonly Dictionary> _exceptionMap;
@@ -19,15 +19,15 @@ public abstract class EventStoreClientBase :
/// The name of the connection.
public string ConnectionName { get; }
- /// The .
- protected EventStoreClientSettings Settings { get; }
+ /// The .
+ protected KurrentClientSettings Settings { get; }
- /// Constructs a new .
- protected EventStoreClientBase(
- EventStoreClientSettings? settings,
+ /// Constructs a new .
+ protected KurrentClientBase(
+ KurrentClientSettings? settings,
Dictionary> exceptionMap
) {
- Settings = settings ?? new EventStoreClientSettings();
+ Settings = settings ?? new KurrentClientSettings();
_exceptionMap = exceptionMap;
_cts = new CancellationTokenSource();
_channelCache = new(Settings);
diff --git a/src/EventStore.Client/EventStoreClientConnectivitySettings.cs b/src/Kurrent.Client/Core/KurrentClientConnectivitySettings.cs
similarity index 89%
rename from src/EventStore.Client/EventStoreClientConnectivitySettings.cs
rename to src/Kurrent.Client/Core/KurrentClientConnectivitySettings.cs
index 92890d2f2..4ea90dcaf 100644
--- a/src/EventStore.Client/EventStoreClientConnectivitySettings.cs
+++ b/src/Kurrent.Client/Core/KurrentClientConnectivitySettings.cs
@@ -4,15 +4,15 @@
namespace EventStore.Client {
///
- /// A class used to describe how to connect to an instance of EventStoreDB.
+ /// A class used to describe how to connect to an instance of KurrentDB.
///
- public class EventStoreClientConnectivitySettings {
+ public class KurrentClientConnectivitySettings {
private const int DefaultPort = 2113;
private bool _insecure;
private Uri? _address;
///
- /// The of the EventStoreDB. Use this when connecting to a single node.
+ /// The of the KurrentDB. Use this when connecting to a single node.
///
public Uri? Address {
get => IsSingleNode ? _address : null;
@@ -84,7 +84,7 @@ public Uri? Address {
public TimeSpan KeepAliveTimeout { get; set; } = TimeSpan.FromSeconds(10);
///
- /// True if pointing to a single EventStoreDB node.
+ /// True if pointing to a single KurrentDB node.
///
public bool IsSingleNode => GossipSeeds.Length == 0;
@@ -113,9 +113,9 @@ public bool Insecure {
public X509Certificate2? ClientCertificate { get; set; }
///
- /// The default .
+ /// The default .
///
- public static EventStoreClientConnectivitySettings Default => new EventStoreClientConnectivitySettings {
+ public static KurrentClientConnectivitySettings Default => new KurrentClientConnectivitySettings {
MaxDiscoverAttempts = 10,
GossipTimeout = TimeSpan.FromSeconds(5),
DiscoveryInterval = TimeSpan.FromMilliseconds(100),
diff --git a/src/EventStore.Client/EventStoreClientOperationOptions.cs b/src/Kurrent.Client/Core/KurrentClientOperationOptions.cs
similarity index 78%
rename from src/EventStore.Client/EventStoreClientOperationOptions.cs
rename to src/Kurrent.Client/Core/KurrentClientOperationOptions.cs
index 94561e213..36c8d5869 100644
--- a/src/EventStore.Client/EventStoreClientOperationOptions.cs
+++ b/src/Kurrent.Client/Core/KurrentClientOperationOptions.cs
@@ -6,7 +6,7 @@ namespace EventStore.Client {
///
/// A class representing the options to apply to an individual operation.
///
- public class EventStoreClientOperationOptions {
+ public class KurrentClientOperationOptions {
///
/// Whether or not to immediately throw a when an append fails.
///
@@ -24,9 +24,9 @@ public class EventStoreClientOperationOptions {
null!;
///
- /// The default .
+ /// The default .
///
- public static EventStoreClientOperationOptions Default => new() {
+ public static KurrentClientOperationOptions Default => new() {
ThrowOnAppendFailure = true,
GetAuthenticationHeaderValue = (userCredentials, _) => new ValueTask(userCredentials.ToString()),
BatchAppendSize = 3 * 1024 * 1024
@@ -34,10 +34,10 @@ public class EventStoreClientOperationOptions {
///
- /// Clones a copy of the current .
+ /// Clones a copy of the current .
///
///
- public EventStoreClientOperationOptions Clone() => new() {
+ public KurrentClientOperationOptions Clone() => new() {
ThrowOnAppendFailure = ThrowOnAppendFailure,
GetAuthenticationHeaderValue = GetAuthenticationHeaderValue,
BatchAppendSize = BatchAppendSize
diff --git a/src/Kurrent.Client/Core/KurrentClientSerializationSettings.cs b/src/Kurrent.Client/Core/KurrentClientSerializationSettings.cs
new file mode 100644
index 000000000..294cdc169
--- /dev/null
+++ b/src/Kurrent.Client/Core/KurrentClientSerializationSettings.cs
@@ -0,0 +1,360 @@
+using System.Text.Json;
+using Kurrent.Client.Core.Serialization;
+
+namespace EventStore.Client;
+
+///
+/// Provides configuration options for messages serialization and deserialization in the KurrentDB client.
+///
+public class KurrentClientSerializationSettings {
+ ///
+ /// The serializer responsible for handling JSON-formatted data. This serializer is used both for
+ /// serializing outgoing JSON messages and deserializing incoming JSON messages. If not specified,
+ /// a default System.Text.Json serializer will be used with standard settings.
+ ///
+ /// That also allows you to bring your custom JSON serializer implementation (e.g. JSON.NET)
+ ///
+ public ISerializer? JsonSerializer { get; set; }
+
+ ///
+ /// The serializer responsible for handling binary data formats. This is used when working with
+ /// binary-encoded messages rather than text-based formats (e.g. Protobuf or Avro). Required when storing
+ /// or retrieving content with "application/octet-stream" content type
+ ///
+ public ISerializer? BytesSerializer { get; set; }
+
+ ///
+ /// Determines which serialization format (JSON or binary) is used by default when writing messages
+ /// where the content type isn't explicitly specified. The default content type is "application/json"
+ ///
+ public ContentType DefaultContentType { get; set; } = ContentType.Json;
+
+ ///
+ /// Defines the custom strategy used to map between the type name stored in messages and .NET type names.
+ /// If not provided the default will be used.
+ /// It resolves the CLR type name to the format: "{stream category name}-{CLR Message Type}".
+ /// You can provide your own implementation of
+ /// and register it here to override the default behaviour
+ ///
+ public IMessageTypeNamingStrategy? MessageTypeNamingStrategy { get; set; }
+
+ ///
+ /// Allows to register mapping of CLR message types to their corresponding message type names used in serialized messages.
+ ///
+ public IDictionary MessageTypeMap { get; set; } = new Dictionary();
+
+ ///
+ /// Registers CLR message types that can be appended to the specific stream category.
+ /// Types will have message type names resolved based on the used
+ ///
+ public IDictionary CategoryMessageTypesMap { get; set; } = new Dictionary();
+
+ ///
+ /// Specifies the CLR type that should be used when deserializing metadata for all events.
+ /// When set, the client will attempt to deserialize event metadata into this type.
+ /// If not provided, will be used.
+ ///
+ public Type? DefaultMetadataType { get; set; }
+
+ ///
+ /// Creates a new instance of serialization settings with either default values or custom configuration.
+ /// This factory method is the recommended way to create serialization settings for the KurrentDB client.
+ ///
+ /// Optional callback to customize the settings. If null, default settings are used.
+ /// A fully configured instance ready to be used with the KurrentDB client.
+ ///
+ ///
+ /// var settings = KurrentClientSerializationSettings.Default(options => {
+ /// options.RegisterMessageType<UserCreated>("user-created");
+ /// options.RegisterMessageType<UserUpdated>("user-updated");
+ /// options.RegisterMessageTypeForCategory<UserCreated>("user");
+ /// });
+ ///
+ ///
+ public static KurrentClientSerializationSettings Default(
+ Action? configure = null
+ ) {
+ var settings = new KurrentClientSerializationSettings();
+
+ configure?.Invoke(settings);
+
+ return settings;
+ }
+
+ ///
+ /// Configures the JSON serializer using custom options while inheriting from the default System.Text.Json settings.
+ /// This allows fine-tuning serialization behavior such as case sensitivity, property naming, etc.
+ ///
+ /// A function that receives the default options and returns modified options.
+ /// The current instance for method chaining.
+ ///
+ ///
+ /// settings.UseJsonSettings(options => {
+ /// options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
+ /// options.WriteIndented = true;
+ /// options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
+ /// return options;
+ /// });
+ ///
+ ///
+ public KurrentClientSerializationSettings UseJsonSettings(
+ Func configure
+ ) {
+ JsonSerializer = new SystemTextJsonSerializer(
+ new SystemTextJsonSerializationSettings
+ { Options = configure(SystemTextJsonSerializationSettings.DefaultJsonSerializerOptions) }
+ );
+
+ return this;
+ }
+
+ ///
+ /// Configures JSON serialization using provided System.Text.Json serializer options.
+ ///
+ /// The JSON serializer options to use.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseJsonSettings(JsonSerializerOptions systemTextJsonSerializerOptions) {
+ JsonSerializer = new SystemTextJsonSerializer(
+ new SystemTextJsonSerializationSettings { Options = systemTextJsonSerializerOptions }
+ );
+
+ return this;
+ }
+
+ ///
+ /// Configures JSON serialization using provided
+ ///
+ /// The SystemTextJson serialization settings to use.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseJsonSettings(
+ SystemTextJsonSerializationSettings jsonSerializationSettings
+ ) {
+ JsonSerializer = new SystemTextJsonSerializer(jsonSerializationSettings);
+
+ return this;
+ }
+
+ ///
+ /// Sets a custom JSON serializer implementation.
+ /// That also allows you to bring your custom JSON serializer implementation (e.g. JSON.NET)
+ ///
+ /// The serializer to use for JSON content.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseJsonSerializer(ISerializer serializer) {
+ JsonSerializer = serializer;
+
+ return this;
+ }
+
+ ///
+ /// Sets a custom binary serializer implementation.
+ /// That also allows you to bring your custom binary serializer implementation (e.g. Protobuf or Avro)
+ ///
+ /// The serializer to use for binary content.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseBytesSerializer(ISerializer serializer) {
+ BytesSerializer = serializer;
+
+ return this;
+ }
+
+ ///
+ /// Configures a custom message type naming strategy.
+ ///
+ /// The type of naming strategy to use.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseMessageTypeNamingStrategy()
+ where TCustomMessageTypeResolutionStrategy : IMessageTypeNamingStrategy, new() =>
+ UseMessageTypeNamingStrategy(new TCustomMessageTypeResolutionStrategy());
+
+ ///
+ /// Configures a custom message type naming strategy.
+ ///
+ /// The naming strategy instance to use.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseMessageTypeNamingStrategy(
+ IMessageTypeNamingStrategy messageTypeNamingStrategy
+ ) {
+ MessageTypeNamingStrategy = messageTypeNamingStrategy;
+
+ return this;
+ }
+
+ ///
+ /// Associates a message type with a specific stream category to enable automatic deserialization.
+ /// In event sourcing, streams are often prefixed with a category (e.g., "user-123", "order-456").
+ /// This method tells the client which message types can appear in streams of a given category.
+ ///
+ /// The event or message type that can appear in the category's streams.
+ /// The category prefix (e.g., "user", "order", "account").
+ /// The current instance for method chaining.
+ ///
+ ///
+ /// // Register event types that can appear in user streams
+ /// settings.RegisterMessageTypeForCategory<UserCreated>("user")
+ /// .RegisterMessageTypeForCategory<UserUpdated>("user")
+ /// .RegisterMessageTypeForCategory<UserDeleted>("user");
+ ///
+ ///
+ public KurrentClientSerializationSettings RegisterMessageTypeForCategory(string categoryName) =>
+ RegisterMessageTypeForCategory(categoryName, typeof(T));
+
+ ///
+ /// Registers multiple message types for a specific stream category.
+ ///
+ /// The category name to register the types with.
+ /// The message types to register.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings RegisterMessageTypeForCategory(string categoryName, params Type[] types) {
+ CategoryMessageTypesMap[categoryName] = CategoryMessageTypesMap.TryGetValue(categoryName, out var current)
+ ? [..current, ..types]
+ : types;
+
+ return this;
+ }
+
+ ///
+ /// Maps a .NET type to a specific message type name that will be stored in the message metadata.
+ /// This mapping is used during automatic deserialization, as it tells the client which CLR type
+ /// to instantiate when encountering a message with a particular type name in the database.
+ ///
+ /// The .NET type to register (typically a message class).
+ /// The string identifier to use for this type in the database.
+ /// The current instance for method chaining.
+ ///
+ /// The type name is often different from the .NET type name to support versioning and evolution
+ /// of your domain model without breaking existing stored messages.
+ ///
+ ///
+ ///
+ /// // Register me types with their corresponding type identifiers
+ /// settings.RegisterMessageType<UserCreated>("user-created-v1")
+ /// .RegisterMessageType<OrderPlaced>("order-placed-v2");
+ ///
+ ///
+ public KurrentClientSerializationSettings RegisterMessageType(string typeName) =>
+ RegisterMessageType(typeof(T), typeName);
+
+ ///
+ /// Registers a message type with a specific type name.
+ ///
+ /// The message type to register.
+ /// The type name to register for the message type.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings RegisterMessageType(Type type, string typeName) {
+ MessageTypeMap[type] = typeName;
+
+ return this;
+ }
+
+ ///
+ /// Registers multiple message types with their corresponding type names.
+ ///
+ /// Dictionary mapping types to their type names.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings RegisterMessageTypes(IDictionary typeMap) {
+ foreach (var map in typeMap) {
+ MessageTypeMap[map.Key] = map.Value;
+ }
+
+ return this;
+ }
+
+ ///
+ /// Configures a strongly-typed metadata class for all mes in the system.
+ /// This enables accessing metadata properties in a type-safe manner rather than using dynamic objects.
+ ///
+ /// The metadata class type containing properties matching the expected metadata fields.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseMetadataType() =>
+ UseMetadataType(typeof(T));
+
+ ///
+ /// Configures a strongly-typed metadata class for all mes in the system.
+ /// This enables accessing metadata properties in a type-safe manner rather than using dynamic objects.
+ ///
+ /// The metadata class type containing properties matching the expected metadata fields.
+ /// The current instance for method chaining.
+ public KurrentClientSerializationSettings UseMetadataType(Type type) {
+ DefaultMetadataType = type;
+
+ return this;
+ }
+
+ ///
+ /// Creates a deep copy of the current serialization settings.
+ ///
+ /// A new instance with copied settings.
+ internal KurrentClientSerializationSettings Clone() {
+ return new KurrentClientSerializationSettings {
+ BytesSerializer = BytesSerializer,
+ JsonSerializer = JsonSerializer,
+ DefaultContentType = DefaultContentType,
+ MessageTypeMap = new Dictionary(MessageTypeMap),
+ CategoryMessageTypesMap = new Dictionary(CategoryMessageTypesMap),
+ MessageTypeNamingStrategy = MessageTypeNamingStrategy
+ };
+ }
+}
+
+///
+/// Provides operation-specific serialization settings that override the global client configuration
+/// for individual operations like reading from or appending to streams. This allows fine-tuning
+/// serialization behavior on a per-operation basis without changing the client-wide settings.
+///
+public class OperationSerializationSettings {
+ ///
+ /// Controls whether mes should be automatically deserialized for this specific operation.
+ /// When enabled (the default), messages will be converted to their appropriate CLR types.
+ /// When disabled, messages will be returned in their raw serialized form.
+ ///
+ public AutomaticDeserialization AutomaticDeserialization { get; private set; } = AutomaticDeserialization.Enabled;
+
+ ///
+ /// A callback that allows customizing serialization settings for this specific operation.
+ /// This can be used to override type mappings, serializers, or other settings just for
+ /// the scope of a single operation without affecting other operations.
+ ///
+ public Action? ConfigureSettings { get; private set; }
+
+ ///
+ /// A pre-configured settings instance that disables automatic deserialization.
+ /// Use this when you need to access raw message data in its serialized form.
+ ///
+ public static readonly OperationSerializationSettings Disabled = new OperationSerializationSettings {
+ AutomaticDeserialization = AutomaticDeserialization.Disabled
+ };
+
+ ///
+ /// Creates operation-specific serialization settings with custom configuration while keeping
+ /// automatic deserialization enabled. This allows operation-specific type mappings or
+ /// serializer settings without changing the global client configuration.
+ ///
+ /// A callback to customize serialization settings for this operation.
+ /// A configured instance of with enabled deserialization.
+ public static OperationSerializationSettings Configure(Action configure) =>
+ new OperationSerializationSettings {
+ AutomaticDeserialization = AutomaticDeserialization.Enabled,
+ ConfigureSettings = configure
+ };
+}
+
+///
+/// Controls whether the KurrentDB client should automatically deserialize message payloads
+/// into their corresponding CLR types based on the configured type mappings.
+///
+public enum AutomaticDeserialization {
+ ///
+ /// Disables automatic deserialization. Messages will be returned in their raw serialized form,
+ /// requiring manual deserialization by the application. Use this when you need direct access to the raw data
+ /// or when working with messages that don't have registered type mappings.
+ ///
+ Disabled = 0,
+
+ ///
+ /// Enables automatic deserialization. The client will attempt to convert messages into their appropriate
+ /// CLR types using the configured serializers and type mappings. This simplifies working with strongly-typed
+ /// domain messages but requires proper type registration.
+ ///
+ Enabled = 1
+}
diff --git a/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs b/src/Kurrent.Client/Core/KurrentClientSettings.ConnectionString.cs
similarity index 82%
rename from src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs
rename to src/Kurrent.Client/Core/KurrentClientSettings.ConnectionString.cs
index 48eb84956..57be0c950 100644
--- a/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs
+++ b/src/Kurrent.Client/Core/KurrentClientSettings.ConnectionString.cs
@@ -1,24 +1,33 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net;
using System.Net.Http;
-using System.Net.Security;
-using System.Security.Authentication;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Timeout_ = System.Threading.Timeout;
namespace EventStore.Client {
- public partial class EventStoreClientSettings {
+ public partial class KurrentClientSettings {
///
/// Creates client settings from a connection string
///
///
///
- public static EventStoreClientSettings Create(string connectionString) =>
+ public static KurrentClientSettings Create(string connectionString) =>
ConnectionStringParser.Parse(connectionString);
+ ///
+ /// Creates client settings from a connection string with additional configuration
+ ///
+ ///
+ /// allows you to make additional customization of client settings
+ ///
+ public static KurrentClientSettings Create(string connectionString, Action configure) {
+ var settings = ConnectionStringParser.Parse(connectionString);
+
+ configure(settings);
+
+ return settings;
+ }
+
private static class ConnectionStringParser {
private const string SchemeSeparator = "://";
private const string UserInfoSeparator = "@";
@@ -41,13 +50,13 @@ private static class ConnectionStringParser {
private const string ThrowOnAppendFailure = nameof(ThrowOnAppendFailure);
private const string KeepAliveInterval = nameof(KeepAliveInterval);
private const string KeepAliveTimeout = nameof(KeepAliveTimeout);
- private const string UserCertFile = nameof(UserCertFile);
+ private const string UserCertFile = nameof(UserCertFile);
private const string UserKeyFile = nameof(UserKeyFile);
private const string UriSchemeDiscover = "esdb+discover";
private static readonly string[] Schemes = { "esdb", UriSchemeDiscover };
- private static readonly int DefaultPort = EventStoreClientConnectivitySettings.Default.ResolvedAddressOrDefault.Port;
+ private static readonly int DefaultPort = KurrentClientConnectivitySettings.Default.ResolvedAddressOrDefault.Port;
private static readonly bool DefaultUseTls = true;
private static readonly Dictionary SettingsType =
@@ -64,11 +73,11 @@ private static class ConnectionStringParser {
{ ThrowOnAppendFailure, typeof(bool) },
{ KeepAliveInterval, typeof(int) },
{ KeepAliveTimeout, typeof(int) },
- { UserCertFile, typeof(string)},
- { UserKeyFile, typeof(string)},
+ { UserCertFile, typeof(string) },
+ { UserKeyFile, typeof(string) },
};
- public static EventStoreClientSettings Parse(string connectionString) {
+ public static KurrentClientSettings Parse(string connectionString) {
var currentIndex = 0;
var schemeIndex = connectionString.IndexOf(SchemeSeparator, currentIndex, StringComparison.Ordinal);
if (schemeIndex == -1)
@@ -77,10 +86,10 @@ public static EventStoreClientSettings Parse(string connectionString) {
var scheme = ParseScheme(connectionString.Substring(0, schemeIndex));
currentIndex = schemeIndex + SchemeSeparator.Length;
- var userInfoIndex = connectionString.IndexOf(UserInfoSeparator, currentIndex, StringComparison.Ordinal);
- (string user, string pass)? userInfo = null;
+ var userInfoIndex = connectionString.IndexOf(UserInfoSeparator, currentIndex, StringComparison.Ordinal);
+ (string user, string pass)? userInfo = null;
if (userInfoIndex != -1) {
- userInfo = ParseUserInfo(connectionString.Substring(currentIndex, userInfoIndex - currentIndex));
+ userInfo = ParseUserInfo(connectionString.Substring(currentIndex, userInfoIndex - currentIndex));
currentIndex = userInfoIndex + UserInfoSeparator.Length;
}
@@ -93,7 +102,7 @@ public static EventStoreClientSettings Parse(string connectionString) {
if (questionMarkIndex == -1) questionMarkIndex = int.MaxValue;
var hostSeparatorIndex = Math.Min(Math.Min(slashIndex, questionMarkIndex), endIndex);
- var hosts = ParseHosts(connectionString.Substring(currentIndex, hostSeparatorIndex - currentIndex));
+ var hosts = ParseHosts(connectionString.Substring(currentIndex, hostSeparatorIndex - currentIndex));
currentIndex = hostSeparatorIndex;
string path = "";
@@ -117,13 +126,13 @@ public static EventStoreClientSettings Parse(string connectionString) {
return CreateSettings(scheme, userInfo, hosts, options);
}
- private static EventStoreClientSettings CreateSettings(
+ private static KurrentClientSettings CreateSettings(
string scheme, (string user, string pass)? userInfo,
EndPoint[] hosts, Dictionary options
) {
- var settings = new EventStoreClientSettings {
- ConnectivitySettings = EventStoreClientConnectivitySettings.Default,
- OperationOptions = EventStoreClientOperationOptions.Default
+ var settings = new KurrentClientSettings {
+ ConnectivitySettings = KurrentClientConnectivitySettings.Default,
+ OperationOptions = KurrentClientOperationOptions.Default
};
if (userInfo.HasValue)
@@ -163,11 +172,11 @@ private static EventStoreClientSettings CreateSettings(
if (typedOptions.TryGetValue(NodePreference, out object? nodePreference)) {
settings.ConnectivitySettings.NodePreference = ((string)nodePreference).ToLowerInvariant() switch {
- "leader" => EventStore.Client.NodePreference.Leader,
- "follower" => EventStore.Client.NodePreference.Follower,
- "random" => EventStore.Client.NodePreference.Random,
+ "leader" => EventStore.Client.NodePreference.Leader,
+ "follower" => EventStore.Client.NodePreference.Follower,
+ "random" => EventStore.Client.NodePreference.Random,
"readonlyreplica" => EventStore.Client.NodePreference.ReadOnlyReplica,
- _ => throw new InvalidSettingException($"Invalid NodePreference: {nodePreference}")
+ _ => throw new InvalidSettingException($"Invalid NodePreference: {nodePreference}")
};
}
@@ -184,17 +193,17 @@ private static EventStoreClientSettings CreateSettings(
if (typedOptions.TryGetValue(KeepAliveInterval, out var keepAliveIntervalMs)) {
settings.ConnectivitySettings.KeepAliveInterval = keepAliveIntervalMs switch {
- -1 => Timeout_.InfiniteTimeSpan,
+ -1 => Timeout_.InfiniteTimeSpan,
int value and >= 0 => TimeSpan.FromMilliseconds(value),
- _ => throw new InvalidSettingException($"Invalid KeepAliveInterval: {keepAliveIntervalMs}")
+ _ => throw new InvalidSettingException($"Invalid KeepAliveInterval: {keepAliveIntervalMs}")
};
}
if (typedOptions.TryGetValue(KeepAliveTimeout, out var keepAliveTimeoutMs)) {
settings.ConnectivitySettings.KeepAliveTimeout = keepAliveTimeoutMs switch {
- -1 => Timeout_.InfiniteTimeSpan,
+ -1 => Timeout_.InfiniteTimeSpan,
int value and >= 0 => TimeSpan.FromMilliseconds(value),
- _ => throw new InvalidSettingException($"Invalid KeepAliveTimeout: {keepAliveTimeoutMs}")
+ _ => throw new InvalidSettingException($"Invalid KeepAliveTimeout: {keepAliveTimeoutMs}")
};
}
@@ -221,7 +230,11 @@ private static EventStoreClientSettings CreateSettings(
}
try {
+#if NET9_0_OR_GREATER
+ settings.ConnectivitySettings.TlsCaFile = X509CertificateLoader.LoadCertificateFromFile(tlsCaFilePath);
+#else
settings.ConnectivitySettings.TlsCaFile = new X509Certificate2(tlsCaFilePath);
+#endif
} catch (CryptographicException) {
throw new InvalidClientCertificateException("Failed to load certificate. Invalid file format.");
}
@@ -239,9 +252,9 @@ HttpMessageHandler CreateDefaultHandler() {
return settings.CreateHttpMessageHandler.Invoke();
var handler = new WinHttpHandler {
- TcpKeepAliveEnabled = true,
- TcpKeepAliveTime = settings.ConnectivitySettings.KeepAliveTimeout,
- TcpKeepAliveInterval = settings.ConnectivitySettings.KeepAliveInterval,
+ TcpKeepAliveEnabled = true,
+ TcpKeepAliveTime = settings.ConnectivitySettings.KeepAliveTimeout,
+ TcpKeepAliveInterval = settings.ConnectivitySettings.KeepAliveInterval,
EnableMultipleHttp2Connections = true
};
@@ -285,7 +298,7 @@ HttpMessageHandler CreateDefaultHandler() {
true when settings.ConnectivitySettings.TlsCaFile is not null => (sender, certificate, chain, errors) => {
if (certificate is not X509Certificate2 peerCertificate || chain is null) return false;
- chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
+ chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
chain.ChainPolicy.CustomTrustStore.Add(settings.ConnectivitySettings.TlsCaFile);
return chain.Build(peerCertificate);
},
@@ -297,7 +310,7 @@ HttpMessageHandler CreateDefaultHandler() {
#endif
}
- static void ConfigureClientCertificate(EventStoreClientSettings settings, IReadOnlyDictionary options) {
+ static void ConfigureClientCertificate(KurrentClientSettings settings, IReadOnlyDictionary options) {
var certPemFilePath = GetOptionValueAsString(UserCertFile);
var keyPemFilePath = GetOptionValueAsString(UserKeyFile);
@@ -318,8 +331,7 @@ static void ConfigureClientCertificate(EventStoreClientSettings settings, IReadO
);
try {
- settings.ConnectivitySettings.ClientCertificate =
- X509Certificates.CreateFromPemFile(certPemFilePath, keyPemFilePath);
+ settings.ConnectivitySettings.ClientCertificate = X509Certificates.CreateFromPemFile(certPemFilePath, keyPemFilePath);
} catch (Exception ex) {
throw new InvalidClientCertificateException("Failed to create client certificate.", ex);
}
diff --git a/src/EventStore.Client/EventStoreClientSettings.cs b/src/Kurrent.Client/Core/KurrentClientSettings.cs
similarity index 65%
rename from src/EventStore.Client/EventStoreClientSettings.cs
rename to src/Kurrent.Client/Core/KurrentClientSettings.cs
index f6a65219e..71bfa446e 100644
--- a/src/EventStore.Client/EventStoreClientSettings.cs
+++ b/src/Kurrent.Client/Core/KurrentClientSettings.cs
@@ -8,9 +8,9 @@
namespace EventStore.Client {
///
- /// A class that represents the settings to use for operations made from an implementation of .
+ /// A class that represents the settings to use for operations made from an implementation of .
///
- public partial class EventStoreClientSettings {
+ public partial class KurrentClientSettings {
///
/// An optional list of s to use.
///
@@ -37,16 +37,16 @@ public partial class EventStoreClientSettings {
public ChannelCredentials? ChannelCredentials { get; set; }
///
- /// The default to use.
+ /// The default to use.
///
- public EventStoreClientOperationOptions OperationOptions { get; set; } =
- EventStoreClientOperationOptions.Default;
+ public KurrentClientOperationOptions OperationOptions { get; set; } =
+ KurrentClientOperationOptions.Default;
///
- /// The to use.
+ /// The to use.
///
- public EventStoreClientConnectivitySettings ConnectivitySettings { get; set; } =
- EventStoreClientConnectivitySettings.Default;
+ public KurrentClientConnectivitySettings ConnectivitySettings { get; set; } =
+ KurrentClientConnectivitySettings.Default;
///
/// The optional to use if none have been supplied to the operation.
@@ -57,5 +57,11 @@ public partial class EventStoreClientSettings {
/// The default deadline for calls. Will not be applied to reads or subscriptions.
///
public TimeSpan? DefaultDeadline { get; set; } = TimeSpan.FromSeconds(10);
+
+ ///
+ /// Provides configuration options for messages serialization and deserialization in the KurrentDB client.
+ /// If null, default settings are used.
+ ///
+ public KurrentClientSerializationSettings Serialization { get; set; } = KurrentClientSerializationSettings.Default();
}
}
diff --git a/src/EventStore.Client/NodePreference.cs b/src/Kurrent.Client/Core/NodePreference.cs
similarity index 88%
rename from src/EventStore.Client/NodePreference.cs
rename to src/Kurrent.Client/Core/NodePreference.cs
index a3f453eb3..530edb87d 100644
--- a/src/EventStore.Client/NodePreference.cs
+++ b/src/Kurrent.Client/Core/NodePreference.cs
@@ -1,6 +1,6 @@
namespace EventStore.Client {
///
- /// Indicates the preferred EventStoreDB node type to connect to.
+ /// Indicates the preferred KurrentDB node type to connect to.
///
public enum NodePreference {
///
diff --git a/src/EventStore.Client/NodePreferenceComparers.cs b/src/Kurrent.Client/Core/NodePreferenceComparers.cs
similarity index 100%
rename from src/EventStore.Client/NodePreferenceComparers.cs
rename to src/Kurrent.Client/Core/NodePreferenceComparers.cs
diff --git a/src/EventStore.Client/NodeSelector.cs b/src/Kurrent.Client/Core/NodeSelector.cs
similarity index 97%
rename from src/EventStore.Client/NodeSelector.cs
rename to src/Kurrent.Client/Core/NodeSelector.cs
index 94c00cc56..661e1e190 100644
--- a/src/EventStore.Client/NodeSelector.cs
+++ b/src/Kurrent.Client/Core/NodeSelector.cs
@@ -26,7 +26,7 @@ internal class NodeSelector {
private readonly Random _random;
private readonly IComparer? _nodeStateComparer;
- public NodeSelector(EventStoreClientSettings settings) {
+ public NodeSelector(KurrentClientSettings settings) {
_random = new Random(0);
_nodeStateComparer = settings.ConnectivitySettings.NodePreference switch {
NodePreference.Leader => NodePreferenceComparers.Leader,
diff --git a/src/EventStore.Client/Position.cs b/src/Kurrent.Client/Core/Position.cs
similarity index 100%
rename from src/EventStore.Client/Position.cs
rename to src/Kurrent.Client/Core/Position.cs
diff --git a/src/EventStore.Client/PrefixFilterExpression.cs b/src/Kurrent.Client/Core/PrefixFilterExpression.cs
similarity index 100%
rename from src/EventStore.Client/PrefixFilterExpression.cs
rename to src/Kurrent.Client/Core/PrefixFilterExpression.cs
diff --git a/src/EventStore.Client/ReconnectionRequired.cs b/src/Kurrent.Client/Core/ReconnectionRequired.cs
similarity index 100%
rename from src/EventStore.Client/ReconnectionRequired.cs
rename to src/Kurrent.Client/Core/ReconnectionRequired.cs
diff --git a/src/EventStore.Client/RegularFilterExpression.cs b/src/Kurrent.Client/Core/RegularFilterExpression.cs
similarity index 100%
rename from src/EventStore.Client/RegularFilterExpression.cs
rename to src/Kurrent.Client/Core/RegularFilterExpression.cs
diff --git a/src/EventStore.Client/ResolvedEvent.cs b/src/Kurrent.Client/Core/ResolvedEvent.cs
similarity index 57%
rename from src/EventStore.Client/ResolvedEvent.cs
rename to src/Kurrent.Client/Core/ResolvedEvent.cs
index 25ca13a78..3b4209082 100644
--- a/src/EventStore.Client/ResolvedEvent.cs
+++ b/src/Kurrent.Client/Core/ResolvedEvent.cs
@@ -1,3 +1,5 @@
+using Kurrent.Client.Core.Serialization;
+
namespace EventStore.Client {
///
/// A structure representing a single event or a resolved link event.
@@ -22,6 +24,23 @@ public readonly struct ResolvedEvent {
///
public EventRecord OriginalEvent => Link ?? Event;
+ ///
+ /// Returns the deserialized message
+ /// It will be provided or equal to null, depending on the automatic deserialization settings you choose.
+ /// If it's null, you can use to deserialize it manually.
+ ///
+ public readonly Message? Message;
+
+ ///
+ /// Returns the deserialized message data.
+ ///
+ public object? DeserializedData => Message?.Data;
+
+ ///
+ /// Returns the deserialized message metadata.
+ ///
+ public object? DeserializedMetadata => Message?.Metadata;
+
///
/// Position of the if available.
///
@@ -49,12 +68,44 @@ public readonly struct ResolvedEvent {
///
///
///
- public ResolvedEvent(EventRecord @event, EventRecord? link, ulong? commitPosition) {
- Event = @event;
- Link = link;
+ public ResolvedEvent(EventRecord @event, EventRecord? link, ulong? commitPosition) : this(
+ @event,
+ link,
+ null,
+ commitPosition
+ ) { }
+
+ ///
+ /// Constructs a new .
+ ///
+ ///
+ ///
+ ///
+ ///
+ ResolvedEvent(
+ EventRecord @event,
+ EventRecord? link,
+ Message? message,
+ ulong? commitPosition
+ ) {
+ Event = @event;
+ Link = link;
+ Message = message;
OriginalPosition = commitPosition.HasValue
? new Position(commitPosition.Value, (link ?? @event).Position.PreparePosition)
: new Position?();
}
+
+ internal static ResolvedEvent From(
+ EventRecord @event,
+ EventRecord? link,
+ ulong? commitPosition,
+ IMessageSerializer messageSerializer
+ ) {
+ var originalEvent = link ?? @event;
+ return messageSerializer.TryDeserialize(originalEvent, out var message)
+ ? new ResolvedEvent(@event, link, message, commitPosition)
+ : new ResolvedEvent(@event, link, commitPosition);
+ }
}
}
diff --git a/src/Kurrent.Client/Core/Serialization/ISerializer.cs b/src/Kurrent.Client/Core/Serialization/ISerializer.cs
new file mode 100644
index 000000000..93382428d
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/ISerializer.cs
@@ -0,0 +1,30 @@
+namespace Kurrent.Client.Core.Serialization;
+
+///
+/// Defines the core serialization capabilities required by the KurrentDB client.
+/// Implementations of this interface handle the conversion between .NET objects and their
+/// binary representation for storage in and retrieval from the event store.
+///
+/// The client ships default System.Text.Json implementation, but custom implementations can be provided or other formats.
+///
+public interface ISerializer {
+ ///
+ /// Converts a .NET object to its binary representation for storage in the event store.
+ ///
+ /// The object to serialize. This could be an event, command, or metadata object.
+ ///
+ /// A binary representation of the object that can be stored in KurrentDB.
+ ///
+ public ReadOnlyMemory Serialize(object value);
+
+ ///
+ /// Reconstructs a .NET object from its binary representation retrieved from the event store.
+ ///
+ /// The binary data to deserialize, typically retrieved from a KurrentDB event.
+ /// The target .NET type to deserialize the data into, determined from message type mappings.
+ ///
+ /// The deserialized object cast to the specified type, or null if the data cannot be deserialized.
+ /// The returned object will be an instance of the specified type or a compatible subtype.
+ ///
+ public object? Deserialize(ReadOnlyMemory data, Type type);
+}
diff --git a/src/Kurrent.Client/Core/Serialization/Message.cs b/src/Kurrent.Client/Core/Serialization/Message.cs
new file mode 100644
index 000000000..83c07bd5e
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/Message.cs
@@ -0,0 +1,109 @@
+using EventStore.Client;
+
+namespace Kurrent.Client.Core.Serialization;
+
+///
+/// Represents a message wrapper in the KurrentDB system, containing both domain data and optional metadata.
+/// Messages can represent events, commands, or other domain objects along with their associated metadata.
+///
+/// The message domain data.
+/// Optional metadata providing additional context about the message, such as correlation IDs, timestamps, or user information.
+/// Unique identifier for this specific message instance. When null, the system will auto-generate an ID.
+public record Message(object Data, object? Metadata, Uuid? MessageId = null) {
+ ///
+ /// Creates a new Message with the specified domain data and message ID, but without metadata.
+ /// This factory method is a convenient shorthand when working with systems that don't require metadata.
+ ///
+ /// The message domain data.
+ /// Unique identifier for this message instance. Must not be Uuid.Empty.
+ /// A new immutable Message instance containing the provided data and ID with null metadata.
+ ///
+ ///
+ /// // Create a message with a specific ID
+ /// var userCreated = new UserCreated { Id = "123", Name = "Alice" };
+ /// var messageId = Uuid.NewUuid();
+ /// var message = Message.From(userCreated, messageId);
+ ///
+ ///
+ public static Message From(object data, Uuid messageId) =>
+ From(data, null, messageId);
+
+ ///
+ /// Creates a new Message with the specified domain data and message ID, but without metadata.
+ /// This factory method is a convenient shorthand when working with systems that don't require metadata.
+ ///
+ /// The message domain data.
+ /// Unique identifier for this message instance. Must not be Uuid.Empty.
+ /// A new immutable Message instance containing the provided data and ID with null metadata.
+ ///
+ ///
+ /// // Create a message with a specific ID
+ /// var userCreated = new UserCreated { Id = "123", Name = "Alice" };
+ /// var messageId = Uuid.NewUuid();
+ /// var message = Message.From(userCreated, messageId);
+ ///
+ ///
+ public static Message From(TMessage data, Uuid messageId) where TMessage : notnull =>
+ From(data, null, messageId);
+
+ ///
+ /// Creates a new Message with the specified domain data and message ID and metadata.
+ ///
+ /// The message domain data.
+ /// Optional metadata providing additional context about the message, such as correlation IDs, timestamps, or user information.
+ /// Unique identifier for this specific message instance.
+ /// A new immutable Message instance with the specified properties.
+ /// Thrown when messageId is explicitly set to Uuid.Empty, which is an invalid identifier.
+ ///
+ ///
+ /// // Create a message with data and metadata
+ /// var orderPlaced = new OrderPlaced { OrderId = "ORD-123", Amount = 99.99m };
+ /// var metadata = new EventMetadata {
+ /// UserId = "user-456",
+ /// Timestamp = DateTimeOffset.UtcNow,
+ /// CorrelationId = correlationId
+ /// };
+ ///
+ /// // Let the system assign an ID automatically
+ /// var message = Message.From(orderPlaced, metadata);
+ ///
+ /// // Or specify a custom ID
+ /// var messageWithId = Message.From(orderPlaced, metadata, Uuid.NewUuid());
+ ///
+ ///
+ public static Message From(object data, object? metadata = null, Uuid? messageId = null) {
+ if (messageId == Uuid.Empty)
+ throw new ArgumentOutOfRangeException(nameof(messageId), "Message ID cannot be an empty UUID.");
+
+ return new Message(data, metadata, messageId);
+ }
+
+ ///
+ /// Creates a new Message with the specified domain data and message ID and metadata.
+ ///
+ /// The message domain data.
+ /// Optional metadata providing additional context about the message, such as correlation IDs, timestamps, or user information.
+ /// Unique identifier for this specific message instance.
+ /// A new immutable Message instance with the specified properties.
+ /// Thrown when messageId is explicitly set to Uuid.Empty, which is an invalid identifier.
+ ///
+ ///
+ /// // Create a message with data and metadata
+ /// var orderPlaced = new OrderPlaced { OrderId = "ORD-123", Amount = 99.99m };
+ /// var metadata = new EventMetadata {
+ /// UserId = "user-456",
+ /// Timestamp = DateTimeOffset.UtcNow,
+ /// CorrelationId = correlationId
+ /// };
+ ///
+ /// // Let the system assign an ID automatically
+ /// var message = Message.From(orderPlaced, metadata);
+ ///
+ /// // Or specify a custom ID
+ /// var messageWithId = Message.From(orderPlaced, metadata, Uuid.NewUuid());
+ ///
+ ///
+ public static Message From(TMessage data, object? metadata = null, Uuid? messageId = null)
+ where TMessage : notnull =>
+ From((object)data, metadata, messageId);
+}
diff --git a/src/Kurrent.Client/Core/Serialization/MessageSerializer.cs b/src/Kurrent.Client/Core/Serialization/MessageSerializer.cs
new file mode 100644
index 000000000..de66372b2
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/MessageSerializer.cs
@@ -0,0 +1,148 @@
+using System.Diagnostics.CodeAnalysis;
+using EventStore.Client;
+
+namespace Kurrent.Client.Core.Serialization;
+
+using static ContentTypeExtensions;
+
+interface IMessageSerializer {
+ public EventData Serialize(Message value, MessageSerializationContext context);
+
+#if NET48
+ public bool TryDeserialize(EventRecord record, out Message? deserialized);
+#else
+ public bool TryDeserialize(EventRecord record, [NotNullWhen(true)] out Message? deserialized);
+#endif
+}
+
+record MessageSerializationContext(
+ string StreamName,
+ ContentType ContentType
+) {
+ public string CategoryName =>
+ StreamName.Split('-').FirstOrDefault() ?? "no_stream_category";
+}
+
+static class MessageSerializerExtensions {
+ public static EventData[] Serialize(
+ this IMessageSerializer serializer,
+ IEnumerable messages,
+ MessageSerializationContext context
+ ) {
+ return messages.Select(m => serializer.Serialize(m, context)).ToArray();
+ }
+
+ public static IMessageSerializer With(
+ this IMessageSerializer defaultMessageSerializer,
+ KurrentClientSerializationSettings defaultSettings,
+ OperationSerializationSettings? operationSettings
+ ) {
+ if (operationSettings == null)
+ return defaultMessageSerializer;
+
+ if (operationSettings.AutomaticDeserialization == AutomaticDeserialization.Disabled)
+ return NullMessageSerializer.Instance;
+
+ if (operationSettings.ConfigureSettings == null)
+ return defaultMessageSerializer;
+
+ var settings = defaultSettings.Clone();
+ operationSettings.ConfigureSettings.Invoke(settings);
+
+ return new MessageSerializer(SchemaRegistry.From(settings));
+ }
+}
+
+class MessageSerializer(SchemaRegistry schemaRegistry) : IMessageSerializer {
+ readonly ISerializer _jsonSerializer =
+ schemaRegistry.GetSerializer(ContentType.Json);
+
+ readonly IMessageTypeNamingStrategy _messageTypeNamingStrategy =
+ schemaRegistry.MessageTypeNamingStrategy;
+
+ public EventData Serialize(Message message, MessageSerializationContext serializationContext) {
+ var (data, metadata, eventId) = message;
+
+ var eventType = _messageTypeNamingStrategy
+ .ResolveTypeName(
+ message.Data.GetType(),
+ new MessageTypeNamingResolutionContext(serializationContext.CategoryName)
+ );
+
+ var serializedData = schemaRegistry
+ .GetSerializer(serializationContext.ContentType)
+ .Serialize(data);
+
+ var serializedMetadata = metadata != null
+ ? _jsonSerializer.Serialize(metadata)
+ : ReadOnlyMemory.Empty;
+
+ return new EventData(
+ eventId ?? Uuid.NewUuid(),
+ eventType,
+ serializedData,
+ serializedMetadata,
+ serializationContext.ContentType.ToMessageContentType()
+ );
+ }
+
+#if NET48
+ public bool TryDeserialize(EventRecord record, out Message? deserialized) {
+#else
+ public bool TryDeserialize(EventRecord record, [NotNullWhen(true)] out Message? deserialized) {
+#endif
+ if (!TryResolveClrType(record, out var clrType)) {
+ deserialized = null;
+ return false;
+ }
+
+ var data = schemaRegistry
+ .GetSerializer(FromMessageContentType(record.ContentType))
+ .Deserialize(record.Data, clrType!);
+
+ if (data == null) {
+ deserialized = null;
+ return false;
+ }
+
+ object? metadata = record.Metadata.Length > 0 && TryResolveClrMetadataType(record, out var clrMetadataType)
+ ? _jsonSerializer.Deserialize(record.Metadata, clrMetadataType!)
+ : null;
+
+ deserialized = Message.From(data, metadata, record.EventId);
+ return true;
+ }
+
+ public static MessageSerializer From(KurrentClientSerializationSettings? settings = null) {
+ settings ??= KurrentClientSerializationSettings.Default();
+
+ return new MessageSerializer(SchemaRegistry.From(settings));
+ }
+
+ bool TryResolveClrType(EventRecord record, out Type? clrType) =>
+ schemaRegistry
+ .MessageTypeNamingStrategy
+ .TryResolveClrType(record.EventType, out clrType);
+
+ bool TryResolveClrMetadataType(EventRecord record, out Type? clrMetadataType) =>
+ schemaRegistry
+ .MessageTypeNamingStrategy
+ .TryResolveClrMetadataType(record.EventType, out clrMetadataType);
+}
+
+class NullMessageSerializer : IMessageSerializer {
+ public static readonly NullMessageSerializer Instance = new NullMessageSerializer();
+
+ public EventData Serialize(Message value, MessageSerializationContext context) {
+ throw new InvalidOperationException("Cannot serialize, automatic deserialization is disabled");
+ }
+
+#if NET48
+ public bool TryDeserialize(EventRecord record, out Message? deserialized) {
+#else
+ public bool TryDeserialize(EventRecord eventRecord, [NotNullWhen(true)] out Message? deserialized) {
+#endif
+ deserialized = null;
+ return false;
+ }
+}
diff --git a/src/Kurrent.Client/Core/Serialization/MessageTypeRegistry.cs b/src/Kurrent.Client/Core/Serialization/MessageTypeRegistry.cs
new file mode 100644
index 000000000..68752884a
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/MessageTypeRegistry.cs
@@ -0,0 +1,76 @@
+using System.Collections.Concurrent;
+
+namespace Kurrent.Client.Core.Serialization;
+
+interface IMessageTypeRegistry {
+ void Register(Type messageType, string messageTypeName);
+ string? GetTypeName(Type messageType);
+ string GetOrAddTypeName(Type clrType, Func getTypeName);
+ Type? GetClrType(string messageTypeName);
+ Type? GetOrAddClrType(string messageTypeName, Func getClrType);
+}
+
+class MessageTypeRegistry : IMessageTypeRegistry {
+ readonly ConcurrentDictionary _typeMap = new();
+ readonly ConcurrentDictionary _typeNameMap = new();
+
+ public void Register(Type messageType, string messageTypeName) {
+ _typeNameMap.AddOrUpdate(messageType, messageTypeName, (_, _) => messageTypeName);
+ _typeMap.AddOrUpdate(messageTypeName, messageType, (_, type) => type);
+ }
+
+ public string? GetTypeName(Type messageType) =>
+#if NET48
+ _typeNameMap.TryGetValue(messageType, out var typeName) ? typeName : null;
+#else
+ _typeNameMap.GetValueOrDefault(messageType);
+#endif
+
+ public string GetOrAddTypeName(Type clrType, Func getTypeName) =>
+ _typeNameMap.GetOrAdd(
+ clrType,
+ _ => {
+ var typeName = getTypeName(clrType);
+
+ _typeMap.TryAdd(typeName, clrType);
+
+ return typeName;
+ }
+ );
+
+ public Type? GetClrType(string messageTypeName) =>
+#if NET48
+ _typeMap.TryGetValue(messageTypeName, out var clrType) ? clrType : null;
+#else
+ _typeMap.GetValueOrDefault(messageTypeName);
+#endif
+
+ public Type? GetOrAddClrType(string messageTypeName, Func getClrType) =>
+ _typeMap.GetOrAdd(
+ messageTypeName,
+ _ => {
+ var clrType = getClrType(messageTypeName);
+
+ if (clrType == null)
+ return null;
+
+ _typeNameMap.TryAdd(clrType, messageTypeName);
+
+ return clrType;
+ }
+ );
+}
+
+static class MessageTypeRegistryExtensions {
+ public static void Register(this IMessageTypeRegistry messageTypeRegistry, string messageTypeName) =>
+ messageTypeRegistry.Register(typeof(T), messageTypeName);
+
+ public static void Register(this IMessageTypeRegistry messageTypeRegistry, IDictionary typeMap) {
+ foreach (var map in typeMap) {
+ messageTypeRegistry.Register(map.Key, map.Value);
+ }
+ }
+
+ public static string? GetTypeName(this IMessageTypeRegistry messageTypeRegistry) =>
+ messageTypeRegistry.GetTypeName(typeof(TMessageType));
+}
diff --git a/src/Kurrent.Client/Core/Serialization/MessageTypeResolutionStrategy.cs b/src/Kurrent.Client/Core/Serialization/MessageTypeResolutionStrategy.cs
new file mode 100644
index 000000000..12ff65f6b
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/MessageTypeResolutionStrategy.cs
@@ -0,0 +1,100 @@
+using System.Diagnostics.CodeAnalysis;
+using Kurrent.Diagnostics.Tracing;
+
+namespace Kurrent.Client.Core.Serialization;
+
+public interface IMessageTypeNamingStrategy {
+ string ResolveTypeName(Type messageType, MessageTypeNamingResolutionContext resolutionContext);
+
+#if NET48
+ bool TryResolveClrType(string messageTypeName, out Type? type);
+#else
+ bool TryResolveClrType(string messageTypeName, [NotNullWhen(true)] out Type? type);
+#endif
+
+
+#if NET48
+ bool TryResolveClrMetadataType(string messageTypeName, out Type? type);
+#else
+ bool TryResolveClrMetadataType(string messageTypeName, [NotNullWhen(true)] out Type? type);
+#endif
+}
+
+public record MessageTypeNamingResolutionContext(string CategoryName);
+
+class MessageTypeNamingStrategyWrapper(
+ IMessageTypeRegistry messageTypeRegistry,
+ IMessageTypeNamingStrategy messageTypeNamingStrategy
+) : IMessageTypeNamingStrategy {
+ public string ResolveTypeName(Type messageType, MessageTypeNamingResolutionContext resolutionContext) {
+ return messageTypeRegistry.GetOrAddTypeName(
+ messageType,
+ _ => messageTypeNamingStrategy.ResolveTypeName(messageType, resolutionContext)
+ );
+ }
+
+#if NET48
+ public bool TryResolveClrType(string messageTypeName, out Type? type) {
+#else
+ public bool TryResolveClrType(string messageTypeName, [NotNullWhen(true)] out Type? type) {
+#endif
+ type = messageTypeRegistry.GetOrAddClrType(
+ messageTypeName,
+ _ => messageTypeNamingStrategy.TryResolveClrType(messageTypeName, out var resolvedType)
+ ? resolvedType
+ : null
+ );
+
+ return type != null;
+ }
+
+#if NET48
+ public bool TryResolveClrMetadataType(string messageTypeName, out Type? type) {
+#else
+ public bool TryResolveClrMetadataType(string messageTypeName, [NotNullWhen(true)] out Type? type) {
+#endif
+ type = messageTypeRegistry.GetOrAddClrType(
+ $"{messageTypeName}-metadata",
+ _ => messageTypeNamingStrategy.TryResolveClrMetadataType(messageTypeName, out var resolvedType)
+ ? resolvedType
+ : null
+ );
+
+ return type != null;
+ }
+}
+
+public class DefaultMessageTypeNamingStrategy(Type? defaultMetadataType) : IMessageTypeNamingStrategy {
+ readonly Type _defaultMetadataType = defaultMetadataType ?? typeof(TracingMetadata);
+
+ public string ResolveTypeName(Type messageType, MessageTypeNamingResolutionContext resolutionContext) =>
+ $"{resolutionContext.CategoryName}-{messageType.FullName}";
+
+#if NET48
+ public bool TryResolveClrType(string messageTypeName, out Type? type) {
+#else
+ public bool TryResolveClrType(string messageTypeName, [NotNullWhen(true)] out Type? type) {
+#endif
+ var categorySeparatorIndex = messageTypeName.IndexOf('-');
+
+ if (categorySeparatorIndex == -1 || categorySeparatorIndex == messageTypeName.Length - 1) {
+ type = null;
+ return false;
+ }
+
+ var clrTypeName = messageTypeName[(categorySeparatorIndex + 1)..];
+
+ type = TypeProvider.GetTypeByFullName(clrTypeName);
+
+ return type != null;
+ }
+
+#if NET48
+ public bool TryResolveClrMetadataType(string messageTypeName, out Type? type) {
+#else
+ public bool TryResolveClrMetadataType(string messageTypeName, [NotNullWhen(true)] out Type? type) {
+#endif
+ type = _defaultMetadataType;
+ return true;
+ }
+}
diff --git a/src/Kurrent.Client/Core/Serialization/SchemaRegistry.cs b/src/Kurrent.Client/Core/Serialization/SchemaRegistry.cs
new file mode 100644
index 000000000..9a5ad7515
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/SchemaRegistry.cs
@@ -0,0 +1,91 @@
+using EventStore.Client;
+
+namespace Kurrent.Client.Core.Serialization;
+
+using static Constants.Metadata.ContentTypes;
+
+public enum ContentType {
+ Json = 1,
+
+ // Protobuf = 2,
+ // Avro = 3,
+ Bytes = 4
+}
+
+static class ContentTypeExtensions {
+ public static ContentType FromMessageContentType(string contentType) =>
+ contentType == ApplicationJson
+ ? ContentType.Json
+ : ContentType.Bytes;
+
+ public static string ToMessageContentType(this ContentType contentType) =>
+ contentType switch {
+ ContentType.Json => ApplicationJson,
+ ContentType.Bytes => ApplicationOctetStream,
+ _ => throw new ArgumentOutOfRangeException(nameof(contentType), contentType, null)
+ };
+}
+
+class SchemaRegistry(
+ IDictionary serializers,
+ IMessageTypeNamingStrategy messageTypeNamingStrategy
+) {
+ public IMessageTypeNamingStrategy MessageTypeNamingStrategy { get; } = messageTypeNamingStrategy;
+
+ public ISerializer GetSerializer(ContentType schemaType) =>
+ serializers[schemaType];
+
+ public static SchemaRegistry From(KurrentClientSerializationSettings settings) {
+ var messageTypeNamingStrategy =
+ settings.MessageTypeNamingStrategy ?? new DefaultMessageTypeNamingStrategy(settings.DefaultMetadataType);
+
+ var categoriesTypeMap = ResolveMessageTypeUsingNamingStrategy(
+ settings.CategoryMessageTypesMap,
+ messageTypeNamingStrategy
+ );
+
+ var messageTypeRegistry = new MessageTypeRegistry();
+ messageTypeRegistry.Register(settings.MessageTypeMap);
+ messageTypeRegistry.Register(categoriesTypeMap);
+
+ var serializers = new Dictionary {
+ {
+ ContentType.Json,
+ settings.JsonSerializer ?? new SystemTextJsonSerializer()
+ }, {
+ ContentType.Bytes,
+ settings.BytesSerializer ?? new SystemTextJsonSerializer()
+ }
+ };
+
+ return new SchemaRegistry(
+ serializers,
+ new MessageTypeNamingStrategyWrapper(
+ messageTypeRegistry,
+ settings.MessageTypeNamingStrategy ?? new DefaultMessageTypeNamingStrategy(settings.DefaultMetadataType)
+ )
+ );
+ }
+
+ static Dictionary ResolveMessageTypeUsingNamingStrategy(
+ IDictionary categoryMessageTypesMap,
+ IMessageTypeNamingStrategy messageTypeNamingStrategy
+ ) =>
+ categoryMessageTypesMap
+ .SelectMany(
+ categoryTypes => categoryTypes.Value.Select(
+ type =>
+ (
+ Type: type,
+ TypeName: messageTypeNamingStrategy.ResolveTypeName(
+ type,
+ new MessageTypeNamingResolutionContext(categoryTypes.Key)
+ )
+ )
+ )
+ )
+ .ToDictionary(
+ ks => ks.Type,
+ vs => vs.TypeName
+ );
+}
diff --git a/src/Kurrent.Client/Core/Serialization/SystemTextJsonSerializer.cs b/src/Kurrent.Client/Core/Serialization/SystemTextJsonSerializer.cs
new file mode 100644
index 000000000..4efa7be96
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/SystemTextJsonSerializer.cs
@@ -0,0 +1,32 @@
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Kurrent.Client.Core.Serialization;
+
+public class SystemTextJsonSerializationSettings {
+ public static readonly JsonSerializerOptions DefaultJsonSerializerOptions =
+ new JsonSerializerOptions(JsonSerializerOptions.Default) {
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
+ PropertyNameCaseInsensitive = false,
+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
+ UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode,
+ UnmappedMemberHandling = JsonUnmappedMemberHandling.Skip,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString,
+ Converters = {
+ new JsonStringEnumConverter(JsonNamingPolicy.CamelCase),
+ }
+ };
+
+ public JsonSerializerOptions Options { get; set; } = DefaultJsonSerializerOptions;
+}
+
+public class SystemTextJsonSerializer(SystemTextJsonSerializationSettings? options = null) : ISerializer {
+ readonly JsonSerializerOptions _options = options?.Options ?? SystemTextJsonSerializationSettings.DefaultJsonSerializerOptions;
+
+ public ReadOnlyMemory Serialize(object value) =>
+ JsonSerializer.SerializeToUtf8Bytes(value, _options);
+
+ public object? Deserialize(ReadOnlyMemory data, Type type) =>
+ !data.IsEmpty ? JsonSerializer.Deserialize(data.Span, type, _options) : null;
+}
diff --git a/src/Kurrent.Client/Core/Serialization/TypeProvider.cs b/src/Kurrent.Client/Core/Serialization/TypeProvider.cs
new file mode 100644
index 000000000..f05f23f87
--- /dev/null
+++ b/src/Kurrent.Client/Core/Serialization/TypeProvider.cs
@@ -0,0 +1,15 @@
+namespace Kurrent.Client.Core.Serialization;
+
+static class TypeProvider {
+ public static Type? GetTypeByFullName(string fullName) =>
+ Type.GetType(fullName) ?? GetFirstMatchingTypeFromCurrentDomainAssembly(fullName);
+
+ static Type? GetFirstMatchingTypeFromCurrentDomainAssembly(string fullName) {
+ var firstNamespacePart = fullName.Split('.')[0];
+
+ return AppDomain.CurrentDomain.GetAssemblies()
+ .OrderByDescending(assembly => assembly.FullName?.StartsWith(firstNamespacePart) == true)
+ .Select(assembly => assembly.GetType(fullName))
+ .FirstOrDefault(type => type != null);
+ }
+}
diff --git a/src/EventStore.Client/ServerCapabilities.cs b/src/Kurrent.Client/Core/ServerCapabilities.cs
similarity index 100%
rename from src/EventStore.Client/ServerCapabilities.cs
rename to src/Kurrent.Client/Core/ServerCapabilities.cs
diff --git a/src/EventStore.Client/SharingProvider.cs b/src/Kurrent.Client/Core/SharingProvider.cs
similarity index 100%
rename from src/EventStore.Client/SharingProvider.cs
rename to src/Kurrent.Client/Core/SharingProvider.cs
diff --git a/src/EventStore.Client/SingleNodeChannelSelector.cs b/src/Kurrent.Client/Core/SingleNodeChannelSelector.cs
similarity index 96%
rename from src/EventStore.Client/SingleNodeChannelSelector.cs
rename to src/Kurrent.Client/Core/SingleNodeChannelSelector.cs
index 79c3affb0..83449e689 100644
--- a/src/EventStore.Client/SingleNodeChannelSelector.cs
+++ b/src/Kurrent.Client/Core/SingleNodeChannelSelector.cs
@@ -12,7 +12,7 @@ internal class SingleNodeChannelSelector : IChannelSelector {
private readonly DnsEndPoint _endPoint;
public SingleNodeChannelSelector(
- EventStoreClientSettings settings,
+ KurrentClientSettings settings,
ChannelCache channelCache) {
_log = settings.LoggerFactory?.CreateLogger() ??
diff --git a/src/EventStore.Client/SingleNodeHttpHandler.cs b/src/Kurrent.Client/Core/SingleNodeHttpHandler.cs
similarity index 81%
rename from src/EventStore.Client/SingleNodeHttpHandler.cs
rename to src/Kurrent.Client/Core/SingleNodeHttpHandler.cs
index b8560152e..0c346a00f 100644
--- a/src/EventStore.Client/SingleNodeHttpHandler.cs
+++ b/src/Kurrent.Client/Core/SingleNodeHttpHandler.cs
@@ -5,9 +5,9 @@
namespace EventStore.Client {
internal class SingleNodeHttpHandler : DelegatingHandler {
- private readonly EventStoreClientSettings _settings;
+ private readonly KurrentClientSettings _settings;
- public SingleNodeHttpHandler(EventStoreClientSettings settings) {
+ public SingleNodeHttpHandler(KurrentClientSettings settings) {
_settings = settings;
}
diff --git a/src/EventStore.Client/StreamFilter.cs b/src/Kurrent.Client/Core/StreamFilter.cs
similarity index 100%
rename from src/EventStore.Client/StreamFilter.cs
rename to src/Kurrent.Client/Core/StreamFilter.cs
diff --git a/src/EventStore.Client/StreamIdentifier.cs b/src/Kurrent.Client/Core/StreamIdentifier.cs
similarity index 94%
rename from src/EventStore.Client/StreamIdentifier.cs
rename to src/Kurrent.Client/Core/StreamIdentifier.cs
index 73e0ee25e..9ca6c9e7e 100644
--- a/src/EventStore.Client/StreamIdentifier.cs
+++ b/src/Kurrent.Client/Core/StreamIdentifier.cs
@@ -3,7 +3,7 @@
namespace EventStore.Client {
#pragma warning disable 1591
- public partial class StreamIdentifier {
+ internal partial class StreamIdentifier {
private string? _cached;
public static implicit operator string?(StreamIdentifier? source) {
diff --git a/src/EventStore.Client/StreamPosition.cs b/src/Kurrent.Client/Core/StreamPosition.cs
similarity index 100%
rename from src/EventStore.Client/StreamPosition.cs
rename to src/Kurrent.Client/Core/StreamPosition.cs
diff --git a/src/EventStore.Client/StreamRevision.cs b/src/Kurrent.Client/Core/StreamRevision.cs
similarity index 100%
rename from src/EventStore.Client/StreamRevision.cs
rename to src/Kurrent.Client/Core/StreamRevision.cs
diff --git a/src/EventStore.Client/StreamState.cs b/src/Kurrent.Client/Core/StreamState.cs
similarity index 100%
rename from src/EventStore.Client/StreamState.cs
rename to src/Kurrent.Client/Core/StreamState.cs
diff --git a/src/EventStore.Client/SubscriptionDroppedReason.cs b/src/Kurrent.Client/Core/SubscriptionDroppedReason.cs
similarity index 100%
rename from src/EventStore.Client/SubscriptionDroppedReason.cs
rename to src/Kurrent.Client/Core/SubscriptionDroppedReason.cs
diff --git a/src/EventStore.Client/SystemRoles.cs b/src/Kurrent.Client/Core/SystemRoles.cs
similarity index 100%
rename from src/EventStore.Client/SystemRoles.cs
rename to src/Kurrent.Client/Core/SystemRoles.cs
diff --git a/src/EventStore.Client/SystemStreams.cs b/src/Kurrent.Client/Core/SystemStreams.cs
similarity index 90%
rename from src/EventStore.Client/SystemStreams.cs
rename to src/Kurrent.Client/Core/SystemStreams.cs
index 67899794b..c8b72503a 100644
--- a/src/EventStore.Client/SystemStreams.cs
+++ b/src/Kurrent.Client/Core/SystemStreams.cs
@@ -4,12 +4,12 @@ namespace EventStore.Client {
///
public static class SystemStreams {
///
- /// A stream containing all events in the EventStoreDB transaction file.
+ /// A stream containing all events in the KurrentDB transaction file.
///
public const string AllStream = "$all";
///
- /// A stream containing links pointing to each stream in the EventStoreDB.
+ /// A stream containing links pointing to each stream in the KurrentDB.
///
public const string StreamsStream = "$streams";
diff --git a/src/EventStore.Client/TaskExtensions.cs b/src/Kurrent.Client/Core/TaskExtensions.cs
similarity index 100%
rename from src/EventStore.Client/TaskExtensions.cs
rename to src/Kurrent.Client/Core/TaskExtensions.cs
diff --git a/src/EventStore.Client/UserCredentials.cs b/src/Kurrent.Client/Core/UserCredentials.cs
similarity index 95%
rename from src/EventStore.Client/UserCredentials.cs
rename to src/Kurrent.Client/Core/UserCredentials.cs
index d944d90d7..6f9012951 100644
--- a/src/EventStore.Client/UserCredentials.cs
+++ b/src/Kurrent.Client/Core/UserCredentials.cs
@@ -5,7 +5,7 @@
namespace EventStore.Client {
///
/// Represents either a username/password pair or a JWT token used for authentication and
- /// authorization to perform operations on the EventStoreDB.
+ /// authorization to perform operations on the KurrentDB.
///
public class UserCredentials {
// ReSharper disable once InconsistentNaming
@@ -51,4 +51,4 @@ public UserCredentials(string bearerToken) {
///
public static implicit operator string(UserCredentials self) => self.ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/EventStore.Client/Uuid.cs b/src/Kurrent.Client/Core/Uuid.cs
similarity index 98%
rename from src/EventStore.Client/Uuid.cs
rename to src/Kurrent.Client/Core/Uuid.cs
index 6c96b1e2d..cbe7a7686 100644
--- a/src/EventStore.Client/Uuid.cs
+++ b/src/Kurrent.Client/Core/Uuid.cs
@@ -51,7 +51,7 @@ namespace EventStore.Client {
///
///
///
- public static Uuid FromDto(UUID dto) =>
+ internal static Uuid FromDto(UUID dto) =>
dto == null
? throw new ArgumentNullException(nameof(dto))
: dto.ValueCase switch {
@@ -106,7 +106,7 @@ private Uuid(long msb, long lsb) {
/// Converts the to the gRPC wire format.
///
///
- public UUID ToDto() =>
+ internal UUID ToDto() =>
new UUID {
Structured = new UUID.Types.Structured {
LeastSignificantBits = _lsb,
diff --git a/src/EventStore.Client/Common/protos/code.proto b/src/Kurrent.Client/Core/protos/code.proto
similarity index 100%
rename from src/EventStore.Client/Common/protos/code.proto
rename to src/Kurrent.Client/Core/protos/code.proto
diff --git a/src/EventStore.Client/Common/protos/gossip.proto b/src/Kurrent.Client/Core/protos/gossip.proto
similarity index 93%
rename from src/EventStore.Client/Common/protos/gossip.proto
rename to src/Kurrent.Client/Core/protos/gossip.proto
index 192b3b0a4..f4ea9bcd4 100644
--- a/src/EventStore.Client/Common/protos/gossip.proto
+++ b/src/Kurrent.Client/Core/protos/gossip.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.gossip;
-option java_package = "com.eventstore.client.gossip";
+option java_package = "io.kurrent.client.gossip";
import "shared.proto";
diff --git a/src/EventStore.Client/Common/protos/operations.proto b/src/Kurrent.Client/Core/protos/operations.proto
similarity index 94%
rename from src/EventStore.Client/Common/protos/operations.proto
rename to src/Kurrent.Client/Core/protos/operations.proto
index e8d5d2726..f4f9ae3c3 100644
--- a/src/EventStore.Client/Common/protos/operations.proto
+++ b/src/Kurrent.Client/Core/protos/operations.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.operations;
-option java_package = "com.eventstore.client.operations";
+option java_package = "io.kurrent.client.operations";
import "shared.proto";
diff --git a/src/EventStore.Client/Common/protos/persistentsubscriptions.proto b/src/Kurrent.Client/Core/protos/persistentsubscriptions.proto
similarity index 99%
rename from src/EventStore.Client/Common/protos/persistentsubscriptions.proto
rename to src/Kurrent.Client/Core/protos/persistentsubscriptions.proto
index a4109cad2..ac63a3a6d 100644
--- a/src/EventStore.Client/Common/protos/persistentsubscriptions.proto
+++ b/src/Kurrent.Client/Core/protos/persistentsubscriptions.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.persistent_subscriptions;
-option java_package = "com.eventstore.dbclient.proto.persistentsubscriptions";
+option java_package = "io.kurrent.dbclient.proto.persistentsubscriptions";
import "shared.proto";
diff --git a/src/EventStore.Client/Common/protos/projectionmanagement.proto b/src/Kurrent.Client/Core/protos/projectionmanagement.proto
similarity index 98%
rename from src/EventStore.Client/Common/protos/projectionmanagement.proto
rename to src/Kurrent.Client/Core/protos/projectionmanagement.proto
index f1733b55a..f16877012 100644
--- a/src/EventStore.Client/Common/protos/projectionmanagement.proto
+++ b/src/Kurrent.Client/Core/protos/projectionmanagement.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.projections;
-option java_package = "com.eventstore.client.projections";
+option java_package = "io.kurrent.client.projections";
import "google/protobuf/struct.proto";
import "shared.proto";
diff --git a/src/EventStore.Client/Common/protos/serverfeatures.proto b/src/Kurrent.Client/Core/protos/serverfeatures.proto
similarity index 85%
rename from src/EventStore.Client/Common/protos/serverfeatures.proto
rename to src/Kurrent.Client/Core/protos/serverfeatures.proto
index cba04f2c6..61c4ab773 100644
--- a/src/EventStore.Client/Common/protos/serverfeatures.proto
+++ b/src/Kurrent.Client/Core/protos/serverfeatures.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.server_features;
-option java_package = "com.eventstore.dbclient.proto.serverfeatures";
+option java_package = "io.kurrent.dbclient.proto.serverfeatures";
import "shared.proto";
service ServerFeatures {
diff --git a/src/EventStore.Client/Common/protos/shared.proto b/src/Kurrent.Client/Core/protos/shared.proto
similarity index 94%
rename from src/EventStore.Client/Common/protos/shared.proto
rename to src/Kurrent.Client/Core/protos/shared.proto
index 2b113aed8..24780afc3 100644
--- a/src/EventStore.Client/Common/protos/shared.proto
+++ b/src/Kurrent.Client/Core/protos/shared.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client;
-option java_package = "com.eventstore.dbclient.proto.shared";
+option java_package = "io.kurrent.dbclient.proto.shared";
import "google/protobuf/empty.proto";
message UUID {
diff --git a/src/EventStore.Client/Common/protos/status.proto b/src/Kurrent.Client/Core/protos/status.proto
similarity index 100%
rename from src/EventStore.Client/Common/protos/status.proto
rename to src/Kurrent.Client/Core/protos/status.proto
diff --git a/src/EventStore.Client/Common/protos/streams.proto b/src/Kurrent.Client/Core/protos/streams.proto
similarity index 99%
rename from src/EventStore.Client/Common/protos/streams.proto
rename to src/Kurrent.Client/Core/protos/streams.proto
index ac599fb82..0eb05295c 100644
--- a/src/EventStore.Client/Common/protos/streams.proto
+++ b/src/Kurrent.Client/Core/protos/streams.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.streams;
-option java_package = "com.eventstore.dbclient.proto.streams";
+option java_package = "io.kurrent.dbclient.proto.streams";
import "shared.proto";
import "status.proto";
diff --git a/src/EventStore.Client/Common/protos/usermanagement.proto b/src/Kurrent.Client/Core/protos/usermanagement.proto
similarity index 97%
rename from src/EventStore.Client/Common/protos/usermanagement.proto
rename to src/Kurrent.Client/Core/protos/usermanagement.proto
index 1fab5a73e..4b55251fd 100644
--- a/src/EventStore.Client/Common/protos/usermanagement.proto
+++ b/src/Kurrent.Client/Core/protos/usermanagement.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
package event_store.client.users;
-option java_package = "com.eventstore.client.users";
+option java_package = "io.kurrent.client.users";
service Users {
rpc Create (CreateReq) returns (CreateResp);
diff --git a/src/Kurrent.Client/Kurrent.Client.csproj b/src/Kurrent.Client/Kurrent.Client.csproj
new file mode 100644
index 000000000..be11d5081
--- /dev/null
+++ b/src/Kurrent.Client/Kurrent.Client.csproj
@@ -0,0 +1,113 @@
+
+
+
+ Kurrent.Client
+ The base GRPC client library for the Kurrent Platform. Get the open source or commercial versions of KurrentDB from https://kurrent.io/
+ Kurrent.Client
+
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Kurrent.Client/OpenTelemetry/TracerProviderBuilderExtensions.cs b/src/Kurrent.Client/OpenTelemetry/TracerProviderBuilderExtensions.cs
new file mode 100644
index 000000000..19885375b
--- /dev/null
+++ b/src/Kurrent.Client/OpenTelemetry/TracerProviderBuilderExtensions.cs
@@ -0,0 +1,19 @@
+using EventStore.Client.Diagnostics;
+using JetBrains.Annotations;
+using OpenTelemetry.Trace;
+
+namespace EventStore.Client.Extensions.OpenTelemetry;
+
+///
+/// Extension methods used to facilitate tracing instrumentation of the EventStore Client.
+///
+[PublicAPI]
+public static class TracerProviderBuilderExtensions {
+ ///
+ /// Adds the EventStore client ActivitySource name to the list of subscribed sources on the
+ ///
+ /// being configured.
+ /// The instance of to chain configuration.
+ public static TracerProviderBuilder AddKurrentClientInstrumentation(this TracerProviderBuilder builder) =>
+ builder.AddSource(KurrentClientDiagnostics.InstrumentationName);
+}
diff --git a/src/EventStore.Client.Operations/DatabaseScavengeResult.cs b/src/Kurrent.Client/Operations/DatabaseScavengeResult.cs
similarity index 100%
rename from src/EventStore.Client.Operations/DatabaseScavengeResult.cs
rename to src/Kurrent.Client/Operations/DatabaseScavengeResult.cs
diff --git a/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs b/src/Kurrent.Client/Operations/KurrentOperationsClient.Admin.cs
similarity index 85%
rename from src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs
rename to src/Kurrent.Client/Operations/KurrentOperationsClient.Admin.cs
index bfa750145..368fdca13 100644
--- a/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs
+++ b/src/Kurrent.Client/Operations/KurrentOperationsClient.Admin.cs
@@ -4,11 +4,11 @@
using EventStore.Client.Operations;
namespace EventStore.Client {
- public partial class EventStoreOperationsClient {
+ public partial class KurrentOperationsClient {
private static readonly Empty EmptyResult = new Empty();
///
- /// Shuts down the EventStoreDB node.
+ /// Shuts down the KurrentDB node.
///
///
///
@@ -21,7 +21,7 @@ public async Task ShutdownAsync(
var channelInfo = await GetChannelInfo(cancellationToken).ConfigureAwait(false);
using var call = new Operations.Operations.OperationsClient(
channelInfo.CallInvoker).ShutdownAsync(EmptyResult,
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -39,7 +39,7 @@ public async Task MergeIndexesAsync(
var channelInfo = await GetChannelInfo(cancellationToken).ConfigureAwait(false);
using var call = new Operations.Operations.OperationsClient(
channelInfo.CallInvoker).MergeIndexesAsync(EmptyResult,
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -57,7 +57,7 @@ public async Task ResignNodeAsync(
var channelInfo = await GetChannelInfo(cancellationToken).ConfigureAwait(false);
using var call = new Operations.Operations.OperationsClient(
channelInfo.CallInvoker).ResignNodeAsync(EmptyResult,
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -77,7 +77,7 @@ public async Task SetNodePriorityAsync(int nodePriority,
using var call = new Operations.Operations.OperationsClient(
channelInfo.CallInvoker).SetNodePriorityAsync(
new SetNodePriorityReq {Priority = nodePriority},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -96,7 +96,7 @@ public async Task RestartPersistentSubscriptions(
using var call = new Operations.Operations.OperationsClient(
channelInfo.CallInvoker).RestartPersistentSubscriptionsAsync(
EmptyResult,
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
}
diff --git a/src/EventStore.Client.Operations/EventStoreOperationsClient.Scavenge.cs b/src/Kurrent.Client/Operations/KurrentOperationsClient.Scavenge.cs
similarity index 92%
rename from src/EventStore.Client.Operations/EventStoreOperationsClient.Scavenge.cs
rename to src/Kurrent.Client/Operations/KurrentOperationsClient.Scavenge.cs
index 43dcfc50f..eb2c88c54 100644
--- a/src/EventStore.Client.Operations/EventStoreOperationsClient.Scavenge.cs
+++ b/src/Kurrent.Client/Operations/KurrentOperationsClient.Scavenge.cs
@@ -4,7 +4,7 @@
using EventStore.Client.Operations;
namespace EventStore.Client {
- public partial class EventStoreOperationsClient {
+ public partial class KurrentOperationsClient {
///
/// Starts a scavenge operation.
///
@@ -38,7 +38,7 @@ public async Task StartScavengeAsync(
StartFromChunk = startFromChunk
}
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
var result = await call.ResponseAsync.ConfigureAwait(false);
return result.ScavengeResult switch {
@@ -68,7 +68,7 @@ public async Task StopScavengeAsync(
Options = new StopScavengeReq.Types.Options {
ScavengeId = scavengeId
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
.ResponseAsync.ConfigureAwait(false);
return result.ScavengeResult switch {
diff --git a/src/EventStore.Client.Operations/EventStoreOperationsClient.cs b/src/Kurrent.Client/Operations/KurrentOperationsClient.cs
similarity index 51%
rename from src/EventStore.Client.Operations/EventStoreOperationsClient.cs
rename to src/Kurrent.Client/Operations/KurrentOperationsClient.cs
index 672383348..d392aa578 100644
--- a/src/EventStore.Client.Operations/EventStoreOperationsClient.cs
+++ b/src/Kurrent.Client/Operations/KurrentOperationsClient.cs
@@ -6,9 +6,9 @@
namespace EventStore.Client;
///
-/// The client used to perform maintenance and other administrative tasks on the EventStoreDB.
+/// The client used to perform maintenance and other administrative tasks on the KurrentDB.
///
-public sealed partial class EventStoreOperationsClient : EventStoreClientBase {
+public sealed partial class KurrentOperationsClient : KurrentClientBase {
static readonly Dictionary> ExceptionMap =
new() {
[Constants.Exceptions.ScavengeNotFound] = ex => new ScavengeNotFoundException(
@@ -19,15 +19,15 @@ public sealed partial class EventStoreOperationsClient : EventStoreClientBase {
readonly ILogger _log;
///
- /// Constructs a new . This method is not intended to be called directly in your code.
+ /// Constructs a new . This method is not intended to be called directly in your code.
///
///
- public EventStoreOperationsClient(IOptions options) : this(options.Value) { }
+ public KurrentOperationsClient(IOptions options) : this(options.Value) { }
///
- /// Constructs a new .
+ /// Constructs a new .
///
///
- public EventStoreOperationsClient(EventStoreClientSettings? settings = null) : base(settings, ExceptionMap) =>
- _log = Settings.LoggerFactory?.CreateLogger() ?? new NullLogger();
-}
\ No newline at end of file
+ public KurrentOperationsClient(KurrentClientSettings? settings = null) : base(settings, ExceptionMap) =>
+ _log = Settings.LoggerFactory?.CreateLogger() ?? new NullLogger();
+}
diff --git a/src/EventStore.Client.Operations/EventStoreOperationsClientServiceCollectionExtensions.cs b/src/Kurrent.Client/Operations/KurrentOperationsClientServiceCollectionExtensions.cs
similarity index 52%
rename from src/EventStore.Client.Operations/EventStoreOperationsClientServiceCollectionExtensions.cs
rename to src/Kurrent.Client/Operations/KurrentOperationsClientServiceCollectionExtensions.cs
index 9f664277f..fc3ce9505 100644
--- a/src/EventStore.Client.Operations/EventStoreOperationsClientServiceCollectionExtensions.cs
+++ b/src/Kurrent.Client/Operations/KurrentOperationsClientServiceCollectionExtensions.cs
@@ -6,54 +6,53 @@
using Grpc.Core.Interceptors;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
-using EventStoreOperationsClient = EventStore.Client.EventStoreOperationsClient;
namespace Microsoft.Extensions.DependencyInjection {
///
- /// A set of extension methods for which provide support for an .
+ /// A set of extension methods for which provide support for an .
///
- public static class EventStoreOperationsClientServiceCollectionExtensions {
+ public static class KurrentOperationsClientServiceCollectionExtensions {
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
///
- public static IServiceCollection AddEventStoreOperationsClient(this IServiceCollection services, Uri address,
+ public static IServiceCollection AddKurrentOperationsClient(this IServiceCollection services, Uri address,
Func? createHttpMessageHandler = null)
- => services.AddEventStoreOperationsClient(options => {
+ => services.AddKurrentOperationsClient(options => {
options.ConnectivitySettings.Address = address;
options.CreateHttpMessageHandler = createHttpMessageHandler;
});
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
- public static IServiceCollection AddEventStoreOperationsClient(this IServiceCollection services,
- Action? configureOptions = null) =>
- services.AddEventStoreOperationsClient(new EventStoreClientSettings(), configureOptions);
+ public static IServiceCollection AddKurrentOperationsClient(this IServiceCollection services,
+ Action? configureOptions = null) =>
+ services.AddKurrentOperationsClient(new KurrentClientSettings(), configureOptions);
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
///
- public static IServiceCollection AddEventStoreOperationsClient(this IServiceCollection services,
- string connectionString, Action? configureOptions = null) =>
- services.AddEventStoreOperationsClient(EventStoreClientSettings.Create(connectionString), configureOptions);
+ public static IServiceCollection AddKurrentOperationsClient(this IServiceCollection services,
+ string connectionString, Action? configureOptions = null) =>
+ services.AddKurrentOperationsClient(KurrentClientSettings.Create(connectionString), configureOptions);
- private static IServiceCollection AddEventStoreOperationsClient(this IServiceCollection services,
- EventStoreClientSettings options, Action? configureOptions) {
+ private static IServiceCollection AddKurrentOperationsClient(this IServiceCollection services,
+ KurrentClientSettings options, Action? configureOptions) {
if (services == null) {
throw new ArgumentNullException(nameof(services));
}
@@ -64,7 +63,7 @@ private static IServiceCollection AddEventStoreOperationsClient(this IServiceCol
options.LoggerFactory ??= provider.GetService();
options.Interceptors ??= provider.GetServices();
- return new EventStoreOperationsClient(options);
+ return new KurrentOperationsClient(options);
});
return services;
diff --git a/src/EventStore.Client.Operations/ScavengeResult.cs b/src/Kurrent.Client/Operations/ScavengeResult.cs
similarity index 100%
rename from src/EventStore.Client.Operations/ScavengeResult.cs
rename to src/Kurrent.Client/Operations/ScavengeResult.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Create.cs
similarity index 98%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Create.cs
index 4cb7acac0..80987b3ce 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Create.cs
@@ -5,7 +5,7 @@
using EventStore.Client.PersistentSubscriptions;
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
private static readonly IDictionary NamedConsumerStrategyToCreateProto
= new Dictionary {
[SystemConsumerStrategies.DispatchToSingle] = CreateReq.Types.ConsumerStrategy.DispatchToSingle,
@@ -245,7 +245,7 @@ private async Task CreateInternalAsync(string streamName, string groupName, IEve
ReadBatchSize = settings.ReadBatchSize
}
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Delete.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Delete.cs
similarity index 93%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Delete.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Delete.cs
index 40ef522ba..d84c0e61a 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Delete.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Delete.cs
@@ -4,7 +4,7 @@
using EventStore.Client.PersistentSubscriptions;
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
///
/// Deletes a persistent subscription.
///
@@ -39,7 +39,7 @@ public async Task DeleteToStreamAsync(string streamName, string groupName, TimeS
new PersistentSubscriptions.PersistentSubscriptions.PersistentSubscriptionsClient(
channelInfo.CallInvoker)
.DeleteAsync(new DeleteReq {Options = deleteOptions},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials,
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials,
cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Info.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Info.cs
similarity index 94%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Info.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Info.cs
index b1cc4bebf..78ececf72 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Info.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Info.cs
@@ -6,7 +6,7 @@
#nullable enable
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
///
/// Gets the status of a persistent subscription to $all
///
@@ -56,7 +56,7 @@ private async Task GetInfoGrpcAsync(GetInfoReq req,
UserCredentials? userCredentials, CallInvoker callInvoker, CancellationToken cancellationToken) {
var result = await new PersistentSubscriptions.PersistentSubscriptions.PersistentSubscriptionsClient(callInvoker)
- .GetInfoAsync(req, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
+ .GetInfoAsync(req, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
.ConfigureAwait(false);
return PersistentSubscriptionInfo.From(result.SubscriptionInfo);
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.List.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.List.cs
similarity index 93%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.List.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.List.cs
index ce588e3f7..a2c92b733 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.List.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.List.cs
@@ -1,14 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
using EventStore.Client.PersistentSubscriptions;
using Grpc.Core;
#nullable enable
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
///
/// Lists persistent subscriptions to $all.
///
@@ -90,7 +85,7 @@ private async Task> ListGrpcAsync(ListRe
UserCredentials? userCredentials, CallInvoker callInvoker, CancellationToken cancellationToken) {
using var call = new PersistentSubscriptions.PersistentSubscriptions.PersistentSubscriptionsClient(callInvoker)
- .ListAsync(req, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ .ListAsync(req, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
ListResp? response = await call.ResponseAsync.ConfigureAwait(false);
diff --git a/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Read.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Read.cs
new file mode 100644
index 000000000..1ed1b40a0
--- /dev/null
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Read.cs
@@ -0,0 +1,783 @@
+using System.Threading.Channels;
+using EventStore.Client.PersistentSubscriptions;
+using EventStore.Client.Diagnostics;
+using Grpc.Core;
+using Kurrent.Client.Core.Serialization;
+using static EventStore.Client.PersistentSubscriptions.PersistentSubscriptions;
+using static EventStore.Client.PersistentSubscriptions.ReadResp.ContentOneofCase;
+
+namespace EventStore.Client {
+ public class SubscribeToPersistentSubscriptionOptions {
+ ///
+ /// The size of the buffer.
+ ///
+ public int BufferSize { get; set; } = 10;
+
+ ///
+ /// The optional user credentials to perform operation with.
+ ///
+ public UserCredentials? UserCredentials { get; set; } = null;
+
+ ///
+ /// Allows to customize or disable the automatic deserialization
+ ///
+ public OperationSerializationSettings? SerializationSettings { get; set; }
+ }
+
+ public class PersistentSubscriptionListener {
+ ///
+ /// A handler called when a new event is received over the subscription.
+ ///
+#if NET48
+ public Func EventAppeared { get; set; } =
+ null!;
+#else
+ public required Func EventAppeared {
+ get;
+ set;
+ }
+#endif
+ ///
+ /// A handler called if the subscription is dropped.
+ ///
+ public Action? SubscriptionDropped { get; set; }
+
+ ///
+ /// Returns the subscription listener with configured handlers
+ ///
+ /// Handler invoked when a new event is received over the subscription.
+ /// A handler invoked if the subscription is dropped.
+ /// A handler called when a checkpoint is reached.
+ /// Set the checkpointInterval in subscription filter options to define how often this method is called.
+ ///
+ ///
+ public static PersistentSubscriptionListener Handle(
+ Func eventAppeared,
+ Action? subscriptionDropped = null
+ ) =>
+ new PersistentSubscriptionListener {
+ EventAppeared = eventAppeared,
+ SubscriptionDropped = subscriptionDropped
+ };
+ }
+
+ partial class KurrentPersistentSubscriptionsClient {
+ ///
+ /// Subscribes to a persistent subscription.
+ ///
+ ///
+ ///
+ ///
+ [Obsolete("SubscribeAsync is no longer supported. Use SubscribeToStream with manual acks instead.", false)]
+ public async Task SubscribeAsync(
+ string streamName,
+ string groupName,
+ Func eventAppeared,
+ Action? subscriptionDropped = null,
+ UserCredentials? userCredentials = null,
+ int bufferSize = 10,
+ bool autoAck = true,
+ CancellationToken cancellationToken = default
+ ) {
+ if (autoAck) {
+ throw new InvalidOperationException(
+ $"AutoAck is no longer supported. Please use {nameof(SubscribeToStream)} with manual acks instead."
+ );
+ }
+
+ return await SubscribeToStreamAsync(
+ streamName,
+ groupName,
+ PersistentSubscriptionListener.Handle(eventAppeared, subscriptionDropped),
+ new SubscribeToPersistentSubscriptionOptions {
+ UserCredentials = userCredentials,
+ BufferSize = bufferSize,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+ }
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged
+ ///
+ ///
+ ///
+ ///
+ public Task SubscribeToStreamAsync(
+ string streamName,
+ string groupName,
+ Func eventAppeared,
+ Action? subscriptionDropped = null,
+ UserCredentials? userCredentials = null,
+ int bufferSize = 10,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToStreamAsync(
+ streamName,
+ groupName,
+ PersistentSubscriptionListener.Handle(eventAppeared, subscriptionDropped),
+ new SubscribeToPersistentSubscriptionOptions {
+ UserCredentials = userCredentials,
+ BufferSize = bufferSize,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged
+ ///
+ ///
+ ///
+ ///
+ public async Task SubscribeToStreamAsync(
+ string streamName,
+ string groupName,
+ PersistentSubscriptionListener listener,
+ SubscribeToPersistentSubscriptionOptions options,
+ CancellationToken cancellationToken = default
+ ) {
+ return await PersistentSubscription
+ .Confirm(
+ SubscribeToStream(streamName, groupName, options, cancellationToken),
+ listener,
+ _log,
+ cancellationToken
+ )
+ .ConfigureAwait(false);
+ }
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged.
+ ///
+ /// The name of the stream to read events from.
+ /// The name of the persistent subscription group.
+ /// The size of the buffer.
+ /// The optional user credentials to perform operation with.
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToStream(
+ string streamName,
+ string groupName,
+ int bufferSize,
+ UserCredentials? userCredentials = null,
+ CancellationToken cancellationToken = default
+ ) {
+ return SubscribeToStream(
+ streamName,
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions {
+ BufferSize = bufferSize,
+ UserCredentials = userCredentials,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+ }
+
+
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged.
+ ///
+ /// The name of the stream to read events from.
+ /// The name of the persistent subscription group.
+ /// The size of the buffer.
+ /// The optional user credentials to perform operation with.
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToStream(
+ string streamName,
+ string groupName,
+ UserCredentials? userCredentials,
+ CancellationToken cancellationToken = default
+ ) {
+ return SubscribeToStream(
+ streamName,
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions {
+ UserCredentials = userCredentials,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+ }
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged.
+ ///
+ /// The name of the stream to read events from.
+ /// The name of the persistent subscription group.
+ /// Optional settings to configure subscription
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToStream(
+ string streamName,
+ string groupName,
+ SubscribeToPersistentSubscriptionOptions options,
+ CancellationToken cancellationToken = default
+ ) {
+ if (streamName == null) {
+ throw new ArgumentNullException(nameof(streamName));
+ }
+
+ if (groupName == null) {
+ throw new ArgumentNullException(nameof(groupName));
+ }
+
+ if (streamName == string.Empty) {
+ throw new ArgumentException($"{nameof(streamName)} may not be empty.", nameof(streamName));
+ }
+
+ if (groupName == string.Empty) {
+ throw new ArgumentException($"{nameof(groupName)} may not be empty.", nameof(groupName));
+ }
+
+ if (options.BufferSize <= 0) {
+ throw new ArgumentOutOfRangeException(nameof(options.BufferSize));
+ }
+
+ var readOptions = new ReadReq.Types.Options {
+ BufferSize = options.BufferSize,
+ GroupName = groupName,
+ UuidOption = new ReadReq.Types.Options.Types.UUIDOption { Structured = new Empty() }
+ };
+
+ if (streamName == SystemStreams.AllStream) {
+ readOptions.All = new Empty();
+ } else {
+ readOptions.StreamIdentifier = streamName;
+ }
+
+ return new PersistentSubscriptionResult(
+ streamName,
+ groupName,
+ async ct => {
+ var channelInfo = await GetChannelInfo(ct).ConfigureAwait(false);
+
+ if (streamName == SystemStreams.AllStream &&
+ !channelInfo.ServerCapabilities.SupportsPersistentSubscriptionsToAll) {
+ throw new NotSupportedException(
+ "The server does not support persistent subscriptions to $all."
+ );
+ }
+
+ return channelInfo;
+ },
+ new() { Options = readOptions },
+ Settings,
+ options.UserCredentials,
+ _messageSerializer.With(Settings.Serialization, options.SerializationSettings),
+ cancellationToken
+ );
+ }
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged
+ ///
+ public Task SubscribeToAllAsync(
+ string groupName,
+ Func eventAppeared,
+ Action? subscriptionDropped = null,
+ UserCredentials? userCredentials = null,
+ int bufferSize = 10,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToAllAsync(
+ groupName,
+ PersistentSubscriptionListener.Handle(eventAppeared, subscriptionDropped),
+ new SubscribeToPersistentSubscriptionOptions {
+ BufferSize = bufferSize,
+ UserCredentials = userCredentials,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged
+ ///
+ public Task SubscribeToAllAsync(
+ string groupName,
+ PersistentSubscriptionListener listener,
+ SubscribeToPersistentSubscriptionOptions options,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToStreamAsync(
+ SystemStreams.AllStream,
+ groupName,
+ listener,
+ options,
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged.
+ ///
+ /// The name of the persistent subscription group.
+ /// The size of the buffer.
+ /// The optional user credentials to perform operation with.
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToAll(
+ string groupName,
+ int bufferSize,
+ UserCredentials? userCredentials = null,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToStream(
+ SystemStreams.AllStream,
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions {
+ BufferSize = bufferSize,
+ UserCredentials = userCredentials,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged.
+ ///
+ /// The name of the persistent subscription group.
+ /// The size of the buffer.
+ /// The optional user credentials to perform operation with.
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToAll(
+ string groupName,
+ UserCredentials? userCredentials,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToStream(
+ SystemStreams.AllStream,
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions {
+ UserCredentials = userCredentials,
+ SerializationSettings = OperationSerializationSettings.Disabled
+ },
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged.
+ ///
+ /// The name of the persistent subscription group.
+ /// Optional settings to configure subscription
+ /// The optional .
+ ///
+ public PersistentSubscriptionResult SubscribeToAll(
+ string groupName,
+ SubscribeToPersistentSubscriptionOptions options,
+ CancellationToken cancellationToken = default
+ ) =>
+ SubscribeToStream(
+ SystemStreams.AllStream,
+ groupName,
+ options,
+ cancellationToken
+ );
+
+ ///
+ public class PersistentSubscriptionResult : IAsyncEnumerable, IAsyncDisposable, IDisposable {
+ const int MaxEventIdLength = 2000;
+
+ readonly ReadReq _request;
+ readonly Channel _channel;
+ readonly CancellationTokenSource _cts;
+ readonly CallOptions _callOptions;
+
+ AsyncDuplexStreamingCall? _call;
+ int _messagesEnumerated;
+
+ ///
+ /// The server-generated unique identifier for the subscription.
+ ///
+ public string? SubscriptionId { get; private set; }
+
+ ///
+ /// The name of the stream to read events from.
+ ///
+ public string StreamName { get; }
+
+ ///
+ /// The name of the persistent subscription group.
+ ///
+ public string GroupName { get; }
+
+ ///
+ /// An . Do not enumerate more than once.
+ ///
+ public IAsyncEnumerable Messages {
+ get {
+ if (Interlocked.Exchange(ref _messagesEnumerated, 1) == 1)
+ throw new InvalidOperationException("Messages may only be enumerated once.");
+
+ return GetMessages();
+
+ async IAsyncEnumerable GetMessages() {
+ try {
+ await foreach (var message in _channel.Reader.ReadAllAsync(_cts.Token)) {
+ if (message is PersistentSubscriptionMessage.SubscriptionConfirmation(var subscriptionId))
+ SubscriptionId = subscriptionId;
+
+ yield return message;
+ }
+ } finally {
+ _cts.Cancel();
+ }
+ }
+ }
+ }
+
+ internal PersistentSubscriptionResult(
+ string streamName,
+ string groupName,
+ Func> selectChannelInfo,
+ ReadReq request,
+ KurrentClientSettings settings,
+ UserCredentials? userCredentials,
+ IMessageSerializer messageSerializer,
+ CancellationToken cancellationToken
+ ) {
+ StreamName = streamName;
+ GroupName = groupName;
+
+ _request = request;
+
+ _callOptions = KurrentCallOptions.CreateStreaming(
+ settings,
+ userCredentials: userCredentials,
+ cancellationToken: cancellationToken
+ );
+
+ _channel = Channel.CreateBounded(ReadBoundedChannelOptions);
+
+ _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+
+ _ = PumpMessages();
+
+ return;
+
+ async Task PumpMessages() {
+ try {
+ var channelInfo = await selectChannelInfo(_cts.Token).ConfigureAwait(false);
+ var client = new PersistentSubscriptionsClient(channelInfo.CallInvoker);
+
+ _call = client.Read(_callOptions);
+
+ await _call.RequestStream.WriteAsync(_request).ConfigureAwait(false);
+
+ await foreach (var response in _call.ResponseStream.ReadAllAsync(_cts.Token)
+ .ConfigureAwait(false)) {
+ PersistentSubscriptionMessage subscriptionMessage = response.ContentCase switch {
+ SubscriptionConfirmation => new PersistentSubscriptionMessage.SubscriptionConfirmation(
+ response.SubscriptionConfirmation.SubscriptionId
+ ),
+ Event => new PersistentSubscriptionMessage.Event(
+ ConvertToResolvedEvent(response, messageSerializer),
+ response.Event.CountCase switch {
+ ReadResp.Types.ReadEvent.CountOneofCase.RetryCount => response.Event.RetryCount,
+ _ => null
+ }
+ ),
+ _ => PersistentSubscriptionMessage.Unknown.Instance
+ };
+
+ if (subscriptionMessage is PersistentSubscriptionMessage.Event evnt)
+ KurrentClientDiagnostics.ActivitySource.TraceSubscriptionEvent(
+ SubscriptionId,
+ evnt.ResolvedEvent,
+ channelInfo,
+ settings,
+ userCredentials
+ );
+
+ await _channel.Writer.WriteAsync(subscriptionMessage, _cts.Token).ConfigureAwait(false);
+ }
+
+ _channel.Writer.TryComplete();
+ } catch (Exception ex) {
+#if NET48
+ switch (ex) {
+ // The gRPC client for .NET 48 uses WinHttpHandler under the hood for sending HTTP requests.
+ // In certain scenarios, this can lead to exceptions of type WinHttpException being thrown.
+ // One such scenario is when the server abruptly closes the connection, which results in a WinHttpException with the error code 12030.
+ // Additionally, there are cases where the server response does not include the 'grpc-status' header.
+ // The absence of this header leads to an RpcException with the status code 'Cancelled' and the message "No grpc-status found on response".
+ // The switch statement below handles these specific exceptions and translates them into the appropriate
+ // PersistentSubscriptionDroppedByServerException exception.
+ case RpcException { StatusCode: StatusCode.Unavailable } rex1
+ when rex1.Status.Detail.Contains("WinHttpException: Error 12030"):
+ case RpcException { StatusCode: StatusCode.Cancelled } rex2
+ when rex2.Status.Detail.Contains("No grpc-status found on response"):
+ ex = new PersistentSubscriptionDroppedByServerException(StreamName, GroupName, ex);
+ break;
+ }
+#endif
+ if (ex is PersistentSubscriptionNotFoundException) {
+ await _channel.Writer
+ .WriteAsync(PersistentSubscriptionMessage.NotFound.Instance, cancellationToken)
+ .ConfigureAwait(false);
+
+ _channel.Writer.TryComplete();
+ return;
+ }
+
+ _channel.Writer.TryComplete(ex);
+ }
+ }
+ }
+
+ ///
+ /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
+ ///
+ /// There is no need to ack a message if you have Auto Ack enabled.
+ /// The of the s to acknowledge. There should not be more than 2000 to ack at a time.
+ public Task Ack(params Uuid[] eventIds) => AckInternal(eventIds);
+
+ ///
+ /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
+ ///
+ /// There is no need to ack a message if you have Auto Ack enabled.
+ /// The of the s to acknowledge. There should not be more than 2000 to ack at a time.
+ public Task Ack(IEnumerable eventIds) => Ack(eventIds.ToArray());
+
+ ///
+ /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
+ ///
+ /// There is no need to ack a message if you have Auto Ack enabled.
+ /// The s to acknowledge. There should not be more than 2000 to ack at a time.
+ public Task Ack(params ResolvedEvent[] resolvedEvents) =>
+ Ack(Array.ConvertAll(resolvedEvents, resolvedEvent => resolvedEvent.OriginalEvent.EventId));
+
+ ///
+ /// Acknowledge that a message has completed processing (this will tell the server it has been processed).
+ ///
+ /// There is no need to ack a message if you have Auto Ack enabled.
+ /// The s to acknowledge. There should not be more than 2000 to ack at a time.
+ public Task Ack(IEnumerable resolvedEvents) =>
+ Ack(resolvedEvents.Select(resolvedEvent => resolvedEvent.OriginalEvent.EventId));
+
+ ///
+ /// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
+ ///
+ /// The to take.
+ /// A reason given.
+ /// The of the s to nak. There should not be more than 2000 to nak at a time.
+ /// The number of eventIds exceeded the limit of 2000.
+ public Task Nack(PersistentSubscriptionNakEventAction action, string reason, params Uuid[] eventIds) =>
+ NackInternal(eventIds, action, reason);
+
+ ///
+ /// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
+ ///
+ /// The to take.
+ /// A reason given.
+ /// The s to nak. There should not be more than 2000 to nak at a time.
+ /// The number of resolvedEvents exceeded the limit of 2000.
+ public Task Nack(
+ PersistentSubscriptionNakEventAction action, string reason, params ResolvedEvent[] resolvedEvents
+ ) =>
+ Nack(action, reason, Array.ConvertAll(resolvedEvents, re => re.OriginalEvent.EventId));
+
+ static ResolvedEvent ConvertToResolvedEvent(
+ ReadResp response,
+ IMessageSerializer messageSerializer
+ ) =>
+ ResolvedEvent.From(
+ ConvertToEventRecord(response.Event.Event)!,
+ ConvertToEventRecord(response.Event.Link),
+ response.Event.PositionCase switch {
+ ReadResp.Types.ReadEvent.PositionOneofCase.CommitPosition => response.Event.CommitPosition,
+ _ => null
+ },
+ messageSerializer
+ );
+
+ Task AckInternal(params Uuid[] eventIds) {
+ if (eventIds.Length > MaxEventIdLength) {
+ throw new ArgumentException(
+ $"The number of eventIds exceeds the maximum length of {MaxEventIdLength}.",
+ nameof(eventIds)
+ );
+ }
+
+ return _call is null
+ ? throw new InvalidOperationException()
+ : _call.RequestStream.WriteAsync(
+ new ReadReq {
+ Ack = new ReadReq.Types.Ack {
+ Ids = {
+ Array.ConvertAll(eventIds, id => id.ToDto())
+ }
+ }
+ }
+ );
+ }
+
+ Task NackInternal(Uuid[] eventIds, PersistentSubscriptionNakEventAction action, string reason) {
+ if (eventIds.Length > MaxEventIdLength) {
+ throw new ArgumentException(
+ $"The number of eventIds exceeds the maximum length of {MaxEventIdLength}.",
+ nameof(eventIds)
+ );
+ }
+
+ return _call is null
+ ? throw new InvalidOperationException()
+ : _call.RequestStream.WriteAsync(
+ new ReadReq {
+ Nack = new ReadReq.Types.Nack {
+ Ids = {
+ Array.ConvertAll(eventIds, id => id.ToDto())
+ },
+ Action = action switch {
+ PersistentSubscriptionNakEventAction.Park => ReadReq.Types.Nack.Types.Action.Park,
+ PersistentSubscriptionNakEventAction.Retry => ReadReq.Types.Nack.Types.Action.Retry,
+ PersistentSubscriptionNakEventAction.Skip => ReadReq.Types.Nack.Types.Action.Skip,
+ PersistentSubscriptionNakEventAction.Stop => ReadReq.Types.Nack.Types.Action.Stop,
+ _ => ReadReq.Types.Nack.Types.Action.Unknown
+ },
+ Reason = reason
+ }
+ }
+ );
+ }
+
+ static EventRecord? ConvertToEventRecord(ReadResp.Types.ReadEvent.Types.RecordedEvent? e) =>
+ e is null
+ ? null
+ : new EventRecord(
+ e.StreamIdentifier!,
+ Uuid.FromDto(e.Id),
+ new StreamPosition(e.StreamRevision),
+ new Position(e.CommitPosition, e.PreparePosition),
+ e.Metadata,
+ e.Data.ToByteArray(),
+ e.CustomMetadata.ToByteArray()
+ );
+
+ ///
+ public async ValueTask DisposeAsync() {
+ await CastAndDispose(_cts).ConfigureAwait(false);
+ await CastAndDispose(_call).ConfigureAwait(false);
+
+ return;
+
+ static async Task CastAndDispose(IDisposable? resource) {
+ switch (resource) {
+ case null:
+ return;
+
+ case IAsyncDisposable resourceAsyncDisposable:
+ await resourceAsyncDisposable.DisposeAsync().ConfigureAwait(false);
+ break;
+
+ default:
+ resource.Dispose();
+ break;
+ }
+ }
+ }
+
+ ///
+ public void Dispose() {
+ _cts.Dispose();
+ _call?.Dispose();
+ }
+
+ ///
+ public async IAsyncEnumerator GetAsyncEnumerator(
+ CancellationToken cancellationToken = default
+ ) {
+ await foreach (var message in Messages.WithCancellation(cancellationToken)) {
+ if (message is not PersistentSubscriptionMessage.Event(var resolvedEvent, _))
+ continue;
+
+ yield return resolvedEvent;
+ }
+ }
+ }
+ }
+
+ public static class KurrentClientPersistentSubscriptionsExtensions {
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged
+ ///
+ ///
+ ///
+ ///
+ public static Task SubscribeToStreamAsync(
+ this KurrentPersistentSubscriptionsClient kurrentClient,
+ string streamName,
+ string groupName,
+ PersistentSubscriptionListener listener,
+ CancellationToken cancellationToken = default
+ ) =>
+ kurrentClient.SubscribeToStreamAsync(
+ streamName,
+ groupName,
+ listener,
+ new SubscribeToPersistentSubscriptionOptions(),
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription. Messages must be manually acknowledged.
+ ///
+ ///
+ /// The name of the stream to read events from.
+ /// The name of the persistent subscription group.
+ /// The optional .
+ ///
+ public static KurrentPersistentSubscriptionsClient.PersistentSubscriptionResult SubscribeToStream(
+ this KurrentPersistentSubscriptionsClient kurrentClient,
+ string streamName,
+ string groupName,
+ CancellationToken cancellationToken = default
+ ) =>
+ kurrentClient.SubscribeToStream(
+ streamName,
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions(),
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged
+ ///
+ public static Task SubscribeToAllAsync(
+ this KurrentPersistentSubscriptionsClient kurrentClient,
+ string groupName,
+ PersistentSubscriptionListener listener,
+ CancellationToken cancellationToken = default
+ ) =>
+ kurrentClient.SubscribeToAllAsync(
+ groupName,
+ listener,
+ new SubscribeToPersistentSubscriptionOptions(),
+ cancellationToken
+ );
+
+ ///
+ /// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged.
+ ///
+ ///
+ /// The name of the persistent subscription group.
+ /// The optional .
+ ///
+ public static KurrentPersistentSubscriptionsClient.PersistentSubscriptionResult SubscribeToAll(
+ this KurrentPersistentSubscriptionsClient kurrentClient,
+ string groupName,
+ CancellationToken cancellationToken = default
+ ) =>
+ kurrentClient.SubscribeToAll(
+ groupName,
+ new SubscribeToPersistentSubscriptionOptions(),
+ cancellationToken
+ );
+ }
+}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.ReplayParked.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.ReplayParked.cs
similarity index 95%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.ReplayParked.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.ReplayParked.cs
index 248ed9143..e13d4a4ad 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.ReplayParked.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.ReplayParked.cs
@@ -7,7 +7,7 @@
#nullable enable
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
///
/// Retry the parked messages of the persistent subscription
///
@@ -75,7 +75,7 @@ private async Task ReplayParkedGrpcAsync(ReplayParkedReq req, long? numberOfEven
}
await new PersistentSubscriptions.PersistentSubscriptions.PersistentSubscriptionsClient(callInvoker)
- .ReplayParkedAsync(req, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
+ .ReplayParkedAsync(req, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
.ConfigureAwait(false);
}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.RestartSubsystem.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.RestartSubsystem.cs
similarity index 90%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.RestartSubsystem.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.RestartSubsystem.cs
index 4d01967d8..a82587442 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.RestartSubsystem.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.RestartSubsystem.cs
@@ -4,7 +4,7 @@
#nullable enable
namespace EventStore.Client {
- partial class EventStorePersistentSubscriptionsClient {
+ partial class KurrentPersistentSubscriptionsClient {
///
/// Restarts the persistent subscriptions subsystem.
///
@@ -14,7 +14,7 @@ public async Task RestartSubsystemAsync(TimeSpan? deadline = null, UserCredentia
var channelInfo = await GetChannelInfo(cancellationToken).ConfigureAwait(false);
if (channelInfo.ServerCapabilities.SupportsPersistentSubscriptionsRestartSubsystem) {
await new PersistentSubscriptions.PersistentSubscriptions.PersistentSubscriptionsClient(channelInfo.CallInvoker)
- .RestartSubsystemAsync(new Empty(), EventStoreCallOptions
+ .RestartSubsystemAsync(new Empty(), KurrentCallOptions
.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken))
.ConfigureAwait(false);
return;
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Update.cs
similarity index 95%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Update.cs
index 1eae92a25..19eb67d4b 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.Update.cs
@@ -1,11 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
using EventStore.Client.PersistentSubscriptions;
namespace EventStore.Client {
- public partial class EventStorePersistentSubscriptionsClient {
+ public partial class KurrentPersistentSubscriptionsClient {
private static readonly IDictionary NamedConsumerStrategyToUpdateProto
= new Dictionary {
[SystemConsumerStrategies.DispatchToSingle] = UpdateReq.Types.ConsumerStrategy.DispatchToSingle,
@@ -64,7 +60,7 @@ private static UpdateReq.Types.AllOptions AllOptionsForUpdateProto(Position posi
[Obsolete("UpdateAsync is no longer supported. Use UpdateToStreamAsync instead.", false)]
public Task UpdateAsync(string streamName, string groupName, PersistentSubscriptionSettings settings,
TimeSpan? deadline = null, UserCredentials? userCredentials = null,
- CancellationToken cancellationToken = default) =>
+ CancellationToken cancellationToken = default) =>
UpdateToStreamAsync(streamName, groupName, settings, deadline, userCredentials, cancellationToken);
///
@@ -148,7 +144,7 @@ public async Task UpdateToStreamAsync(string streamName, string groupName, Persi
}
}
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.cs
similarity index 64%
rename from src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.cs
rename to src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.cs
index 411de3e70..0d251f59c 100644
--- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClient.cs
@@ -1,26 +1,28 @@
using System.Text.Encodings.Web;
using System.Threading.Channels;
using Grpc.Core;
+using Kurrent.Client.Core.Serialization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
namespace EventStore.Client {
///
- /// The client used to manage persistent subscriptions in the EventStoreDB.
+ /// The client used to manage persistent subscriptions in the KurrentDB.
///
- public sealed partial class EventStorePersistentSubscriptionsClient : EventStoreClientBase {
- private static BoundedChannelOptions ReadBoundedChannelOptions = new (1) {
+ public sealed partial class KurrentPersistentSubscriptionsClient : KurrentClientBase {
+ static BoundedChannelOptions ReadBoundedChannelOptions = new (1) {
SingleReader = true,
SingleWriter = true,
AllowSynchronousContinuations = true
};
- private readonly ILogger _log;
+ readonly ILogger _log;
+ readonly IMessageSerializer _messageSerializer;
///
- /// Constructs a new .
+ /// Constructs a new .
///
- public EventStorePersistentSubscriptionsClient(EventStoreClientSettings? settings) : base(settings,
+ public KurrentPersistentSubscriptionsClient(KurrentClientSettings? settings) : base(settings,
new Dictionary> {
[Constants.Exceptions.PersistentSubscriptionDoesNotExist] = ex => new
PersistentSubscriptionNotFoundException(
@@ -35,8 +37,10 @@ public EventStorePersistentSubscriptionsClient(EventStoreClientSettings? setting
ex.Trailers.First(x => x.Key == Constants.Exceptions.StreamName).Value,
ex.Trailers.First(x => x.Key == Constants.Exceptions.GroupName).Value, ex)
}) {
- _log = Settings.LoggerFactory?.CreateLogger()
- ?? new NullLogger();
+ _log = Settings.LoggerFactory?.CreateLogger()
+ ?? new NullLogger();
+
+ _messageSerializer = MessageSerializer.From(settings?.Serialization);
}
private static string UrlEncode(string s) {
diff --git a/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClientCollectionExtensions.cs b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClientCollectionExtensions.cs
new file mode 100644
index 000000000..9ed65e091
--- /dev/null
+++ b/src/Kurrent.Client/PersistentSubscriptions/KurrentPersistentSubscriptionsClientCollectionExtensions.cs
@@ -0,0 +1,61 @@
+// ReSharper disable CheckNamespace
+
+using System;
+using System.Net.Http;
+using EventStore.Client;
+using Grpc.Core.Interceptors;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.Extensions.DependencyInjection {
+ ///
+ /// A set of extension methods for which provide support for an .
+ ///
+ public static class KurrentPersistentSubscriptionsClientCollectionExtensions {
+ ///
+ /// Adds an to the .
+ ///
+ ///
+ public static IServiceCollection AddKurrentPersistentSubscriptionsClient(this IServiceCollection services,
+ Uri address, Func? createHttpMessageHandler = null)
+ => services.AddKurrentPersistentSubscriptionsClient(options => {
+ options.ConnectivitySettings.Address = address;
+ options.CreateHttpMessageHandler = createHttpMessageHandler;
+ });
+
+ ///
+ /// Adds an to the .
+ ///
+ ///
+ public static IServiceCollection AddKurrentPersistentSubscriptionsClient(this IServiceCollection services,
+ Action? configureSettings = null) =>
+ services.AddKurrentPersistentSubscriptionsClient(new KurrentClientSettings(),
+ configureSettings);
+
+ ///
+ /// Adds an to the .
+ ///
+ ///
+ public static IServiceCollection AddKurrentPersistentSubscriptionsClient(this IServiceCollection services,
+ string connectionString, Action? configureSettings = null) =>
+ services.AddKurrentPersistentSubscriptionsClient(KurrentClientSettings.Create(connectionString),
+ configureSettings);
+
+ private static IServiceCollection AddKurrentPersistentSubscriptionsClient(this IServiceCollection services,
+ KurrentClientSettings settings, Action? configureSettings) {
+ if (services == null) {
+ throw new ArgumentNullException(nameof(services));
+ }
+
+ configureSettings?.Invoke(settings);
+ services.TryAddSingleton(provider => {
+ settings.LoggerFactory ??= provider.GetService();
+ settings.Interceptors ??= provider.GetServices();
+
+ return new KurrentPersistentSubscriptionsClient(settings);
+ });
+ return services;
+ }
+ }
+}
+// ReSharper restore CheckNamespace
diff --git a/src/EventStore.Client.PersistentSubscriptions/MaximumSubscribersReachedException.cs b/src/Kurrent.Client/PersistentSubscriptions/MaximumSubscribersReachedException.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/MaximumSubscribersReachedException.cs
rename to src/Kurrent.Client/PersistentSubscriptions/MaximumSubscribersReachedException.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscription.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscription.cs
similarity index 75%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscription.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscription.cs
index f3d19b42e..0674cb9ac 100644
--- a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscription.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscription.cs
@@ -7,7 +7,9 @@ namespace EventStore.Client {
/// Represents a persistent subscription connection.
///
public class PersistentSubscription : IDisposable {
- private readonly EventStorePersistentSubscriptionsClient.PersistentSubscriptionResult _persistentSubscriptionResult;
+ private readonly KurrentPersistentSubscriptionsClient.PersistentSubscriptionResult
+ _persistentSubscriptionResult;
+
private readonly IAsyncEnumerator _enumerator;
private readonly Func _eventAppeared;
private readonly Action _subscriptionDropped;
@@ -22,10 +24,11 @@ public class PersistentSubscription : IDisposable {
public string SubscriptionId { get; }
internal static async Task Confirm(
- EventStorePersistentSubscriptionsClient.PersistentSubscriptionResult persistentSubscriptionResult,
- Func eventAppeared,
- Action subscriptionDropped,
- ILogger log, UserCredentials? userCredentials, CancellationToken cancellationToken = default) {
+ KurrentPersistentSubscriptionsClient.PersistentSubscriptionResult persistentSubscriptionResult,
+ PersistentSubscriptionListener listener,
+ ILogger log,
+ CancellationToken cancellationToken = default
+ ) {
var enumerator = persistentSubscriptionResult
.Messages
.GetAsyncEnumerator(cancellationToken);
@@ -34,29 +37,39 @@ internal static async Task Confirm(
return (result, enumerator.Current) switch {
(true, PersistentSubscriptionMessage.SubscriptionConfirmation (var subscriptionId)) =>
- new PersistentSubscription(persistentSubscriptionResult, enumerator, subscriptionId, eventAppeared,
- subscriptionDropped, log, cancellationToken),
+ new PersistentSubscription(
+ persistentSubscriptionResult,
+ enumerator,
+ subscriptionId,
+ listener,
+ log,
+ cancellationToken
+ ),
(true, PersistentSubscriptionMessage.NotFound) =>
- throw new PersistentSubscriptionNotFoundException(persistentSubscriptionResult.StreamName,
- persistentSubscriptionResult.GroupName),
+ throw new PersistentSubscriptionNotFoundException(
+ persistentSubscriptionResult.StreamName,
+ persistentSubscriptionResult.GroupName
+ ),
_ => throw new InvalidOperationException("Subscription could not be confirmed.")
};
}
// PersistentSubscription takes responsibility for disposing the call and the disposable
private PersistentSubscription(
- EventStorePersistentSubscriptionsClient.PersistentSubscriptionResult persistentSubscriptionResult,
- IAsyncEnumerator enumerator, string subscriptionId,
- Func eventAppeared,
- Action subscriptionDropped, ILogger log,
- CancellationToken cancellationToken) {
+ KurrentPersistentSubscriptionsClient.PersistentSubscriptionResult persistentSubscriptionResult,
+ IAsyncEnumerator enumerator,
+ string subscriptionId,
+ PersistentSubscriptionListener listener,
+ ILogger log,
+ CancellationToken cancellationToken
+ ) {
_persistentSubscriptionResult = persistentSubscriptionResult;
- _enumerator = enumerator;
- SubscriptionId = subscriptionId;
- _eventAppeared = eventAppeared;
- _subscriptionDropped = subscriptionDropped;
- _log = log;
- _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+ _enumerator = enumerator;
+ SubscriptionId = subscriptionId;
+ _eventAppeared = listener.EventAppeared;
+ _subscriptionDropped = listener.SubscriptionDropped ?? delegate { };
+ _log = log;
+ _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Task.Run(Subscribe, _cts.Token);
}
@@ -91,7 +104,6 @@ public Task Ack(params ResolvedEvent[] resolvedEvents) =>
public Task Ack(IEnumerable resolvedEvents) =>
Ack(resolvedEvents.Select(resolvedEvent => resolvedEvent.OriginalEvent.EventId));
-
///
/// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
///
@@ -99,7 +111,8 @@ public Task Ack(IEnumerable resolvedEvents) =>
/// A reason given.
/// The of the s to nak. There should not be more than 2000 to nak at a time.
/// The number of eventIds exceeded the limit of 2000.
- public Task Nack(PersistentSubscriptionNakEventAction action, string reason, params Uuid[] eventIds) => NackInternal(eventIds, action, reason);
+ public Task Nack(PersistentSubscriptionNakEventAction action, string reason, params Uuid[] eventIds) =>
+ NackInternal(eventIds, action, reason);
///
/// Acknowledge that a message has failed processing (this will tell the server it has not been processed).
@@ -108,10 +121,15 @@ public Task Ack(IEnumerable resolvedEvents) =>
/// A reason given.
/// The s to nak. There should not be more than 2000 to nak at a time.
/// The number of resolvedEvents exceeded the limit of 2000.
- public Task Nack(PersistentSubscriptionNakEventAction action, string reason,
- params ResolvedEvent[] resolvedEvents) =>
- Nack(action, reason,
- Array.ConvertAll(resolvedEvents, resolvedEvent => resolvedEvent.OriginalEvent.EventId));
+ public Task Nack(
+ PersistentSubscriptionNakEventAction action, string reason,
+ params ResolvedEvent[] resolvedEvents
+ ) =>
+ Nack(
+ action,
+ reason,
+ Array.ConvertAll(resolvedEvents, resolvedEvent => resolvedEvent.OriginalEvent.EventId)
+ );
///
public void Dispose() => SubscriptionDropped(SubscriptionDroppedReason.Disposed);
@@ -121,7 +139,8 @@ private async Task Subscribe() {
try {
while (await _enumerator.MoveNextAsync(_cts.Token).ConfigureAwait(false)) {
- if (_enumerator.Current is not PersistentSubscriptionMessage.Event(var resolvedEvent, var retryCount)) {
+ if (_enumerator.Current is not
+ PersistentSubscriptionMessage.Event(var resolvedEvent, var retryCount)) {
continue;
}
@@ -129,39 +148,54 @@ private async Task Subscribe() {
if (_subscriptionDroppedInvoked != 0) {
return;
}
- SubscriptionDropped(SubscriptionDroppedReason.ServerError,
+
+ SubscriptionDropped(
+ SubscriptionDroppedReason.ServerError,
new PersistentSubscriptionNotFoundException(
- _persistentSubscriptionResult.StreamName, _persistentSubscriptionResult.GroupName));
+ _persistentSubscriptionResult.StreamName,
+ _persistentSubscriptionResult.GroupName
+ )
+ );
+
return;
}
-
+
_log.LogTrace(
"Persistent Subscription {subscriptionId} received event {streamName}@{streamRevision} {position}",
- SubscriptionId, resolvedEvent.OriginalEvent.EventStreamId,
- resolvedEvent.OriginalEvent.EventNumber, resolvedEvent.OriginalEvent.Position);
+ SubscriptionId,
+ resolvedEvent.OriginalEvent.EventStreamId,
+ resolvedEvent.OriginalEvent.EventNumber,
+ resolvedEvent.OriginalEvent.Position
+ );
try {
await _eventAppeared(
this,
resolvedEvent,
retryCount,
- _cts.Token).ConfigureAwait(false);
+ _cts.Token
+ ).ConfigureAwait(false);
} catch (Exception ex) when (ex is ObjectDisposedException or OperationCanceledException) {
if (_subscriptionDroppedInvoked != 0) {
return;
}
- _log.LogWarning(ex,
+ _log.LogWarning(
+ ex,
"Persistent Subscription {subscriptionId} was dropped because cancellation was requested by another caller.",
- SubscriptionId);
+ SubscriptionId
+ );
SubscriptionDropped(SubscriptionDroppedReason.Disposed);
return;
} catch (Exception ex) {
- _log.LogError(ex,
+ _log.LogError(
+ ex,
"Persistent Subscription {subscriptionId} was dropped because the subscriber made an error.",
- SubscriptionId);
+ SubscriptionId
+ );
+
SubscriptionDropped(SubscriptionDroppedReason.SubscriberError, ex);
return;
@@ -169,16 +203,21 @@ await _eventAppeared(
}
} catch (Exception ex) {
if (_subscriptionDroppedInvoked == 0) {
- _log.LogError(ex,
+ _log.LogError(
+ ex,
"Persistent Subscription {subscriptionId} was dropped because an error occurred on the server.",
- SubscriptionId);
+ SubscriptionId
+ );
+
SubscriptionDropped(SubscriptionDroppedReason.ServerError, ex);
}
} finally {
if (_subscriptionDroppedInvoked == 0) {
_log.LogError(
"Persistent Subscription {subscriptionId} was unexpectedly terminated.",
- SubscriptionId);
+ SubscriptionId
+ );
+
SubscriptionDropped(SubscriptionDroppedReason.ServerError);
}
}
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs
similarity index 91%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs
index 29b42bb49..b25ea4f72 100644
--- a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionDroppedByServerException.cs
@@ -2,7 +2,7 @@
namespace EventStore.Client {
///
- /// The exception that is thrown when the EventStoreDB drops a persistent subscription.
+ /// The exception that is thrown when the KurrentDB drops a persistent subscription.
///
public class PersistentSubscriptionDroppedByServerException : Exception {
///
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionExtraStatistic.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionExtraStatistic.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionExtraStatistic.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionExtraStatistic.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionInfo.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionInfo.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionInfo.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionInfo.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionMessage.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionMessage.cs
similarity index 86%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionMessage.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionMessage.cs
index eabde9b62..7cd0d848d 100644
--- a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionMessage.cs
+++ b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionMessage.cs
@@ -4,10 +4,10 @@ namespace EventStore.Client {
///
public abstract record PersistentSubscriptionMessage {
///
- /// A that represents a .
+ /// A that represents a .
///
- /// The .
- /// The number of times the has been retried.
+ /// The .
+ /// The number of times the has been retried.
public record Event(ResolvedEvent ResolvedEvent, int? RetryCount) : PersistentSubscriptionMessage;
///
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionNakEventAction.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionNakEventAction.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionNakEventAction.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionNakEventAction.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionNotFoundException.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionNotFoundException.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionNotFoundException.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionNotFoundException.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs b/src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionSettings.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs
rename to src/Kurrent.Client/PersistentSubscriptions/PersistentSubscriptionSettings.cs
diff --git a/src/EventStore.Client.PersistentSubscriptions/SystemConsumerStrategies.cs b/src/Kurrent.Client/PersistentSubscriptions/SystemConsumerStrategies.cs
similarity index 100%
rename from src/EventStore.Client.PersistentSubscriptions/SystemConsumerStrategies.cs
rename to src/Kurrent.Client/PersistentSubscriptions/SystemConsumerStrategies.cs
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Control.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Control.cs
similarity index 89%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Control.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Control.cs
index e21da92fc..ff6ba9619 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Control.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Control.cs
@@ -4,7 +4,7 @@
using EventStore.Client.Projections;
namespace EventStore.Client {
- public partial class EventStoreProjectionManagementClient {
+ public partial class KurrentProjectionManagementClient {
///
/// Enables a projection.
///
@@ -21,7 +21,7 @@ public async Task EnableAsync(string name, TimeSpan? deadline = null, UserCreden
Options = new EnableReq.Types.Options {
Name = name
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -42,7 +42,7 @@ public async Task ResetAsync(string name, TimeSpan? deadline = null, UserCredent
Name = name,
WriteCheckpoint = true
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -82,7 +82,7 @@ public async Task RestartSubsystemAsync(TimeSpan? deadline = null, UserCredentia
var channelInfo = await GetChannelInfo(cancellationToken).ConfigureAwait(false);
using var call = new Projections.Projections.ProjectionsClient(
channelInfo.CallInvoker).RestartSubsystemAsync(new Empty(),
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -95,7 +95,7 @@ private async Task DisableInternalAsync(string name, bool writeCheckpoint, TimeS
Name = name,
WriteCheckpoint = writeCheckpoint
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
}
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Create.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Create.cs
similarity index 88%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Create.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Create.cs
index 54498cabf..cae9b400e 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Create.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Create.cs
@@ -4,7 +4,7 @@
using EventStore.Client.Projections;
namespace EventStore.Client {
- public partial class EventStoreProjectionManagementClient {
+ public partial class KurrentProjectionManagementClient {
///
/// Creates a one-time projection.
///
@@ -22,7 +22,7 @@ public async Task CreateOneTimeAsync(string query, TimeSpan? deadline = null,
OneTime = new Empty(),
Query = query
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -49,7 +49,7 @@ public async Task CreateContinuousAsync(string name, string query, bool trackEmi
},
Query = query
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
@@ -73,7 +73,7 @@ public async Task CreateTransientAsync(string name, string query, TimeSpan? dead
},
Query = query
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
}
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.State.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.State.cs
similarity index 96%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.State.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.State.cs
index 64187fe1f..ca24d6ef9 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.State.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.State.cs
@@ -8,7 +8,7 @@
using Type = System.Type;
namespace EventStore.Client {
- public partial class EventStoreProjectionManagementClient {
+ public partial class KurrentProjectionManagementClient {
static readonly JsonSerializerOptions DefaultJsonSerializerOptions = new JsonSerializerOptions();
///
@@ -80,7 +80,7 @@ private async ValueTask GetResultInternalAsync(string name, string? parti
Name = name,
Partition = partition ?? string.Empty
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
var response = await call.ResponseAsync.ConfigureAwait(false);
return response.Result;
@@ -155,7 +155,7 @@ private async ValueTask GetStateInternalAsync(string name, string? partit
Name = name,
Partition = partition ?? string.Empty
}
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
var response = await call.ResponseAsync.ConfigureAwait(false);
return response.State;
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Statistics.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Statistics.cs
similarity index 89%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Statistics.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Statistics.cs
index 0b49b8b80..425831165 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Statistics.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Statistics.cs
@@ -8,7 +8,7 @@
using Grpc.Core;
namespace EventStore.Client {
- public partial class EventStoreProjectionManagementClient {
+ public partial class KurrentProjectionManagementClient {
///
/// List the of all one-time projections.
///
@@ -21,7 +21,7 @@ public IAsyncEnumerable ListOneTimeAsync(TimeSpan? deadline =
ListInternalAsync(new StatisticsReq.Types.Options {
OneTime = new Empty()
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
cancellationToken);
///
@@ -37,7 +37,7 @@ public IAsyncEnumerable ListContinuousAsync(TimeSpan? deadlin
ListInternalAsync(new StatisticsReq.Types.Options {
Continuous = new Empty()
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
cancellationToken);
///
@@ -53,7 +53,7 @@ public IAsyncEnumerable ListContinuousAsync(TimeSpan? deadlin
CancellationToken cancellationToken = default) => ListInternalAsync(new StatisticsReq.Types.Options {
Name = name
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
cancellationToken)
.FirstOrDefaultAsync(cancellationToken).AsTask();
@@ -69,7 +69,7 @@ public IAsyncEnumerable ListAllAsync(TimeSpan? deadline = nul
ListInternalAsync(new StatisticsReq.Types.Options {
All = new Empty()
},
- EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
+ KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken),
cancellationToken);
private async IAsyncEnumerable ListInternalAsync(StatisticsReq.Types.Options options,
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Update.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Update.cs
similarity index 87%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Update.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Update.cs
index 8f577e92c..368ff3be4 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClient.Update.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.Update.cs
@@ -4,7 +4,7 @@
using EventStore.Client.Projections;
namespace EventStore.Client {
- public partial class EventStoreProjectionManagementClient {
+ public partial class KurrentProjectionManagementClient {
///
/// Updates a projection.
///
@@ -32,7 +32,7 @@ public async Task UpdateAsync(string name, string query, bool? emitEnabled = nul
using var call = new Projections.Projections.ProjectionsClient(
channelInfo.CallInvoker).UpdateAsync(new UpdateReq {
Options = options
- }, EventStoreCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
+ }, KurrentCallOptions.CreateNonStreaming(Settings, deadline, userCredentials, cancellationToken));
await call.ResponseAsync.ConfigureAwait(false);
}
diff --git a/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.cs
new file mode 100644
index 000000000..12e1abf18
--- /dev/null
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClient.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using Grpc.Core;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Microsoft.Extensions.Options;
+
+namespace EventStore.Client {
+ ///
+ ///The client used to manage projections on the KurrentDB.
+ ///
+ public sealed partial class KurrentProjectionManagementClient : KurrentClientBase {
+ private readonly ILogger _log;
+
+ ///
+ /// Constructs a new . This method is not intended to be called directly from your code.
+ ///
+ ///
+ public KurrentProjectionManagementClient(IOptions options) : this(options.Value) {
+ }
+
+ ///
+ /// Constructs a new .
+ ///
+ ///
+ public KurrentProjectionManagementClient(KurrentClientSettings? settings) : base(settings,
+ new Dictionary>()) {
+ _log = settings?.LoggerFactory?.CreateLogger() ??
+ new NullLogger();
+ }
+ }
+}
diff --git a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClientCollectionExtensions.cs b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClientCollectionExtensions.cs
similarity index 52%
rename from src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClientCollectionExtensions.cs
rename to src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClientCollectionExtensions.cs
index ea1f634f6..5fe3932b7 100644
--- a/src/EventStore.Client.ProjectionManagement/EventStoreProjectionManagementClientCollectionExtensions.cs
+++ b/src/Kurrent.Client/ProjectionManagement/KurrentProjectionManagementClientCollectionExtensions.cs
@@ -9,51 +9,51 @@
namespace Microsoft.Extensions.DependencyInjection {
///
- /// A set of extension methods for which provide support for an .
+ /// A set of extension methods for which provide support for an .
///
- public static class EventStoreProjectionManagementClientCollectionExtensions {
+ public static class KurrentProjectionManagementClientCollectionExtensions {
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
///
- public static IServiceCollection AddEventStoreProjectionManagementClient(this IServiceCollection services,
+ public static IServiceCollection AddKurrentProjectionManagementClient(this IServiceCollection services,
Uri address,
Func? createHttpMessageHandler = null)
- => services.AddEventStoreProjectionManagementClient(options => {
+ => services.AddKurrentProjectionManagementClient(options => {
options.ConnectivitySettings.Address = address;
options.CreateHttpMessageHandler = createHttpMessageHandler;
});
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
- public static IServiceCollection AddEventStoreProjectionManagementClient(this IServiceCollection services,
- Action? configureSettings = null) =>
- services.AddEventStoreProjectionManagementClient(new EventStoreClientSettings(), configureSettings);
+ public static IServiceCollection AddKurrentProjectionManagementClient(this IServiceCollection services,
+ Action? configureSettings = null) =>
+ services.AddKurrentProjectionManagementClient(new KurrentClientSettings(), configureSettings);
///
- /// Adds an to the .
+ /// Adds an to the .
///
///
///
///
///
///
- public static IServiceCollection AddEventStoreProjectionManagementClient(this IServiceCollection services,
- string connectionString, Action? configureSettings = null) =>
- services.AddEventStoreProjectionManagementClient(EventStoreClientSettings.Create(connectionString),
+ public static IServiceCollection AddKurrentProjectionManagementClient(this IServiceCollection services,
+ string connectionString, Action? configureSettings = null) =>
+ services.AddKurrentProjectionManagementClient(KurrentClientSettings.Create(connectionString),
configureSettings);
- private static IServiceCollection AddEventStoreProjectionManagementClient(this IServiceCollection services,
- EventStoreClientSettings settings, Action? configureSettings) {
+ private static IServiceCollection AddKurrentProjectionManagementClient(this IServiceCollection services,
+ KurrentClientSettings settings, Action? configureSettings) {
if (services == null) {
throw new ArgumentNullException(nameof(services));
}
@@ -64,7 +64,7 @@ private static IServiceCollection AddEventStoreProjectionManagementClient(this I
settings.LoggerFactory ??= provider.GetService();
settings.Interceptors ??= provider.GetServices();
- return new EventStoreProjectionManagementClient(settings);
+ return new KurrentProjectionManagementClient(settings);
});
return services;
diff --git a/src/EventStore.Client.ProjectionManagement/ProjectionDetails.cs b/src/Kurrent.Client/ProjectionManagement/ProjectionDetails.cs
similarity index 100%
rename from src/EventStore.Client.ProjectionManagement/ProjectionDetails.cs
rename to src/Kurrent.Client/ProjectionManagement/ProjectionDetails.cs
diff --git a/src/EventStore.Client.Streams/ConditionalWriteResult.cs b/src/Kurrent.Client/Streams/ConditionalWriteResult.cs
similarity index 100%
rename from src/EventStore.Client.Streams/ConditionalWriteResult.cs
rename to src/Kurrent.Client/Streams/ConditionalWriteResult.cs
diff --git a/src/EventStore.Client.Streams/ConditionalWriteStatus.cs b/src/Kurrent.Client/Streams/ConditionalWriteStatus.cs
similarity index 100%
rename from src/EventStore.Client.Streams/ConditionalWriteStatus.cs
rename to src/Kurrent.Client/Streams/ConditionalWriteStatus.cs
diff --git a/src/EventStore.Client.Streams/DeadLine.cs b/src/Kurrent.Client/Streams/DeadLine.cs
similarity index 100%
rename from src/EventStore.Client.Streams/DeadLine.cs
rename to src/Kurrent.Client/Streams/DeadLine.cs
diff --git a/src/Kurrent.Client/Streams/DecisionMaking/Aggregate.cs b/src/Kurrent.Client/Streams/DecisionMaking/Aggregate.cs
new file mode 100644
index 000000000..b87ff7095
--- /dev/null
+++ b/src/Kurrent.Client/Streams/DecisionMaking/Aggregate.cs
@@ -0,0 +1,38 @@
+using Kurrent.Client.Core.Serialization;
+using Kurrent.Client.Streams.GettingState;
+
+namespace Kurrent.Client.Streams.DecisionMaking;
+
+public interface IAggregate : IState {
+ Message[] DequeueUncommittedMessages();
+}
+
+public interface IAggregate : IAggregate