diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4c90f839..24f76f03 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -31,6 +31,7 @@ jobs: uses: ./.github/workflows/tests.yml with: esdb_version: ${{ matrix.version }} + secrets: inherit linting: needs: tests diff --git a/.github/workflows/test-dispatch.yml b/.github/workflows/test-dispatch.yml index 44ca8a6e..42b27448 100644 --- a/.github/workflows/test-dispatch.yml +++ b/.github/workflows/test-dispatch.yml @@ -14,3 +14,4 @@ jobs: uses: ./.github/workflows/tests.yml with: esdb_version: ${{ inputs.version }} + secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7aa04dba..8fb400b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,6 +41,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Login to Cloudsmith + uses: docker/login-action@v3 + with: + registry: docker.eventstore.com + username: ${{ secrets.CLOUDSMITH_CICD_USER }} + password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} + - name: Generate certificates run: docker-compose --file docker-compose.yml up @@ -63,6 +70,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Login to Cloudsmith + uses: docker/login-action@v3 + with: + registry: docker.eventstore.com + username: ${{ secrets.CLOUDSMITH_CICD_USER }} + password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} + - name: Set up cluster with Docker Compose run: | docker-compose -f cluster-docker-compose.yml up -d diff --git a/CHANGELOG.md b/CHANGELOG.md index 08eeeb6f..3d47d21e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Updated +- Update dependencies. [EventStore-Client-Go#172](https://github.com/EventStore/EventStore-Client-Go/pull/172) + +## [4.0.0] - 2024-03-03 +### Added +- Add missing persistent subscription API samples. [EventStore-Client-Go#168](https://github.com/EventStore/EventStore-Client-Go/pull/168) +- Implement projections API. [EventStore-Client-Go#167](https://github.com/EventStore/EventStore-Client-Go/pull/167) + +### Changed +- Move to google uuid implementation. [EventStore-Client-Go#169](https://github.com/EventStore/EventStore-Client-Go/pull/169) +- Move to version 4. [EventStore-Client-Go#170](https://github.com/EventStore/EventStore-Client-Go/pull/170) + ## [3.3.0] - 2024-01-27 ### Added - CaughtUp and FellBehind message handling in subscription [EventStore-Client-Go#161](https://github.com/EventStore/EventStore-Client-Go/pull/161) @@ -54,4 +66,4 @@ All notable changes to this project will be documented in this file. ### Fixed - Fix RequiresLeader header when node preference is set to Leader. [EventStore-Client-Go#126](https://github.com/EventStore/EventStore-Client-Go/pull/126) -- Respect `MaxDiscoverAttempts` setting. [EventStore-Client-Go#122](https://github.com/EventStore/EventStore-Client-Go/pull/122) +- Respect `MaxDiscoverAttempts` setting. [EventStore-Client-Go#122](https://github.com/EventStore/EventStore-Client-Go/pull/122) \ No newline at end of file diff --git a/README.md b/README.md index 686ff462..564f23ac 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # EventStoreDB Client SDK for Golang [![Actions Status](https://github.com/eventstore/EventStore-Client-Go/workflows/CI/badge.svg?branch=master)](https://github.com/eventstore/EventStore-Client-Go/actions) +EventStoreDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures. + This repository contains an [EventStoreDB][es] Client SDK written in Go. ## Developing @@ -37,6 +39,11 @@ export EVENTSTORE_DOCKER_TAG_ENV="21.10.0-focal" make test ``` +## Communities + +- [Discuss](https://discuss.eventstore.com/) +- [Discord (Event Store)](https://discord.gg/Phn9pmCw3t) + ## Security If you find a vulnerability in our software, please contact us. You can find how to reach out us and report it at https://www.eventstore.com/security#security @@ -52,4 +59,4 @@ All contributions to the SDK are made via GitHub Pull Requests, and must be lice [docker compose]: https://www.docker.com/ [es]: https://eventstore.com -[make]: https://www.gnu.org/software/make/ +[make]: https://www.gnu.org/software/make/ \ No newline at end of file diff --git a/cluster-docker-compose.yml b/cluster-docker-compose.yml index e014536b..bba68629 100644 --- a/cluster-docker-compose.yml +++ b/cluster-docker-compose.yml @@ -10,7 +10,7 @@ services: network_mode: none cert-gen: - image: eventstore/es-gencert-cli:1.0.2 + image: docker.eventstore.com/eventstore-utils/es-gencert-cli:latest entrypoint: bash user: "1000:1000" command: > @@ -26,7 +26,7 @@ services: - volumes-provisioner esdb-node1: - image: ghcr.io/eventstore/eventstore:${EVENTSTORE_DOCKER_TAG_ENV:-latest} + image: docker.eventstore.com/eventstore-ce/eventstoredb-ce:${EVENTSTORE_DOCKER_TAG_ENV:-latest} env_file: - shared.env environment: @@ -47,7 +47,7 @@ services: - cert-gen esdb-node2: - image: ghcr.io/eventstore/eventstore:${EVENTSTORE_DOCKER_TAG_ENV:-latest} + image: docker.eventstore.com/eventstore-ce/eventstoredb-ce:${EVENTSTORE_DOCKER_TAG_ENV:-latest} env_file: - shared.env environment: @@ -68,7 +68,7 @@ services: - cert-gen esdb-node3: - image: ghcr.io/eventstore/eventstore:${EVENTSTORE_DOCKER_TAG_ENV:-latest} + image: docker.eventstore.com/eventstore-ce/eventstoredb-ce:${EVENTSTORE_DOCKER_TAG_ENV:-latest} env_file: - shared.env environment: diff --git a/docker-compose.yml b/docker-compose.yml index 62b87287..38a5265c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: network_mode: "none" setup: - image: eventstore/es-gencert-cli:1.0.2 + image: docker.eventstore.com/eventstore-utils/es-gencert-cli:latest entrypoint: bash user: "1000:1000" command: > diff --git a/esdb/containers_test.go b/esdb/containers_test.go index 35ca197f..a641dacb 100644 --- a/esdb/containers_test.go +++ b/esdb/containers_test.go @@ -42,7 +42,7 @@ type EventStoreDockerConfig struct { } const ( - DEFAULT_EVENTSTORE_DOCKER_REPOSITORY = "ghcr.io/eventstore/testdata" + DEFAULT_EVENTSTORE_DOCKER_REPOSITORY = "docker.eventstore.com/eventstore-utils/testdata" DEFAULT_EVENTSTORE_DOCKER_TAG = "latest" DEFAULT_EVENTSTORE_DOCKER_PORT = "2113" ) diff --git a/samples/persistentSubscriptions.go b/samples/persistentSubscriptions.go index 2b63fa6e..5829ff2d 100644 --- a/samples/persistentSubscriptions.go +++ b/samples/persistentSubscriptions.go @@ -2,6 +2,9 @@ package samples import ( "context" + "fmt" + "log" + "strings" "github.com/EventStore/EventStore-Client-Go/v3/esdb" ) @@ -125,3 +128,123 @@ func deletePersistentSubscription(client *esdb.Client) { } // #endregion delete-persistent-subscription } + +func deletePersistentSubscriptionToAll(client *esdb.Client) { + // #region delete-persistent-subscription-all + err := client.DeletePersistentSubscriptionToAll(context.Background(), "test-stream", esdb.DeletePersistentSubscriptionOptions{}) + + if err != nil { + panic(err) + } + // #endregion delete-persistent-subscription-all +} + +func getPersistentSubscriptionToStreamInfo(client *esdb.Client) { + // #region get-persistent-subscription-to-stream-info + info, err := client.GetPersistentSubscriptionInfo(context.Background(), "test-stream", "subscription-group", esdb.GetPersistentSubscriptionOptions{}) + + if err != nil { + panic(err) + } + + log.Printf("groupName: %s eventsource: %s status: %s", info.GroupName, info.EventSource, info.Status) + // #endregion get-persistent-subscription-to-stream-info +} + +func getPersistentSubscriptionToAllInfo(client *esdb.Client) { + // #region get-persistent-subscription-to-all-info + info, err := client.GetPersistentSubscriptionInfoToAll(context.Background(), "subscription-group", esdb.GetPersistentSubscriptionOptions{}) + + if err != nil { + panic(err) + } + + log.Printf("groupName: %s eventsource: %s status: %s", info.GroupName, info.EventSource, info.Status) + // #endregion get-persistent-subscription-to-all-info +} + +func replayParkedToStream(client *esdb.Client) { + // #region replay-parked-of-persistent-subscription-to-stream + err := client.ReplayParkedMessages(context.Background(), "test-stream", "subscription-group", esdb.ReplayParkedMessagesOptions{ + StopAt: 10, + }) + + if err != nil { + panic(err) + } + // #endregion replay-parked-of-persistent-subscription-to-stream +} + +func replayParkedToAll(client *esdb.Client) { + // #region replay-parked-of-persistent-subscription-to-all + err := client.ReplayParkedMessagesToAll(context.Background(), "subscription-group", esdb.ReplayParkedMessagesOptions{ + StopAt: 10, + }) + + if err != nil { + panic(err) + } + // #endregion replay-parked-of-persistent-subscription-to-all +} + +func listPersistentSubscriptionsToStream(client *esdb.Client) { + // #region list-persistent-subscriptions-to-stream + subs, err := client.ListPersistentSubscriptionsForStream(context.Background(), "test-stream", esdb.ListPersistentSubscriptionsOptions{}) + + if err != nil { + panic(err) + } + + var entries []string + + for i := range subs { + entries = append( + entries, + fmt.Sprintf( + "groupName: %s eventSource: %s status: %s", + subs[i].GroupName, + subs[i].EventSource, + subs[i].Status, + ), + ) + } + + log.Printf("subscriptions to stream: [ %s ]", strings.Join(entries, ",")) + // #endregion list-persistent-subscriptions-to-stream +} + +func listPersistentSubscriptionsToAll(client *esdb.Client) { + // #region list-persistent-subscriptions-to-all + subs, err := client.ListPersistentSubscriptionsToAll(context.Background(), esdb.ListPersistentSubscriptionsOptions{}) + + if err != nil { + panic(err) + } + + var entries []string + + for i := range subs { + entries = append( + entries, + fmt.Sprintf( + "groupName: %s eventSource: %s status: %s", + subs[i].GroupName, + subs[i].EventSource, + subs[i].Status, + ), + ) + } + + log.Printf("subscriptions to stream: [ %s ]", strings.Join(entries, ",")) + // #endregion list-persistent-subscriptions-to-all +} + +func restartPersistentSubscriptionSubsystem(client *esdb.Client) { + // #region restart-persistent-subscription-subsystem + err := client.RestartPersistentSubscriptionSubsystem(context.Background(), esdb.RestartPersistentSubscriptionSubsystemOptions{}) + + if err != nil { + panic(err) + } + // #endregion restart-persistent-subscription-subsystem +}