CQRS & Event-Sourcing Framework for Go.

goes - Event-Sourcing Framework

Go Reference Test

goes is a collection of interfaces, tools, and backend implementations that allow you to write event-sourced applicatios in Go.

If you have any questions or feedback, feel free to open an issue or start a discussion.

Getting Started

Installation

goes is not yet versioned because the API still changes too often. Install using a specific commit hash and make sure to install nested modules with /...

go get github.com/modernice/goes/...@<commit-hash>

Examples

Introduction

This documentation assumes knowledge of CQRS, event-sourcing, and other related concepts. Please make yourself familiar with these before reading further.

Features

Components

goes provides incrementally adoptable components that together form a complete framework for building event-sourced applications. Read a component's README for a guide on how to use it.

Backends

Event Bus

Event Store

Contributing

TBD

License

Apache License, Version 2.0

Owner
Comments
  • Review projection APIs

    Review projection APIs

    This issue will determine if the different projection APIs are even necessary to solve common problems or if there are better solutions to these problems that don't require these APIs.

    HistoryDependent

    The HistoryDependent API is used by projection jobs to determine which events a projection needs to properly update itself. If a projection implements HistoryDependent, it can hint to a projection job that it requires the full history of the events that are configured in the job, instead of just the (published) events that triggered the job.

    ProgressAware

    The ProgressAware API is usually used by persistent projections that are stored in a database. When a projection job is triggered, the application fetches the current projection state from the database, applies the events on it and saves it back to the database. A ProgressAware projection keeps track of the last applied event in terms of the event time, to ensure that no event is applied twice to the projection.

  • chore(deps): bump go.mongodb.org/mongo-driver from 1.10.3 to 1.10.4

    chore(deps): bump go.mongodb.org/mongo-driver from 1.10.3 to 1.10.4

    Bumps go.mongodb.org/mongo-driver from 1.10.3 to 1.10.4.

    Commits
    • 29dffaf Update version to v1.10.4
    • 861364b GODRIVER-2620 Fix hostname parsing for SRV polling. (#1112)
    • 5762c6a GODRIVER-2543 Run make fmt with the latest Go version. #1065
    • 2855941 GODRIVER-2565 Abort transaction before CommitLoop if context errored. (#1101)
    • 3f59691 Update version to v1.10.4-prerelease
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Automated lookups

    Automated lookups

    package user
    
    const Aggregate = "user"
    const NameLookup = "name"
    const EmailLookup = "email"
    
    const CreatedEvent = "user.created"
    
    type CreatedData struct {
      Name string
      Email string
    }
    
    func (evt Created) ProvideLookup(p lookup.Provider)  {
      p.Provide(Aggregate, NameLookup, evt.Name)
      p.Provide(Aggregate, EmailLookup, evt.Email)
    }
    
    // somewhere else
    
    var ctx context.Context
    
    var store event.Store
    l := lookup.New(store, Created) // create lookup from events in event store
    
    errs, err := l.Run(ctx) // run the lookup projection
    
    var aggregateID uuid.UUID
    
    userID, err := l.Lookup(ctx, Aggregate, EmailLookup, "[email protected]")
    
    • only allows string values or use interface{}?
    • reverse lookups?
  • chore(deps): bump github.com/nats-io/nats.go from 1.22.0 to 1.22.1

    chore(deps): bump github.com/nats-io/nats.go from 1.22.0 to 1.22.1

    Bumps github.com/nats-io/nats.go from 1.22.0 to 1.22.1.

    Release notes

    Sourced from github.com/nats-io/nats.go's releases.

    Release v1.22.1

    Changelog

    Changed

    • Service API:
      • Monitoring subjects for a service are no longer uppercase (#1166)
      • Changed RequestHandler signature to no longer return an error (#1166)

    Complete Changes

    https://github.com/nats-io/nats.go/compare/v1.22.0...v1.22.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/nats-io/nats.go from 1.21.0 to 1.22.0

    chore(deps): bump github.com/nats-io/nats.go from 1.21.0 to 1.22.0

    Bumps github.com/nats-io/nats.go from 1.21.0 to 1.22.0.

    Release notes

    Sourced from github.com/nats-io/nats.go's releases.

    Release v1.22.0

    Changelog

    Overview

    This release adds a beta implementation of micro package, which provides API for creating and monitoring microservices on top of NATS connection.

    Added

    • Service API beta implementation (#1160)
    • Getters for connection callbacks (#1162)

    Complete Changes

    https://github.com/nats-io/nats.go/compare/v1.21.0...v1.22.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump go.mongodb.org/mongo-driver from 1.11.0 to 1.11.1

    chore(deps): bump go.mongodb.org/mongo-driver from 1.11.0 to 1.11.1

    Bumps go.mongodb.org/mongo-driver from 1.11.0 to 1.11.1.

    Release notes

    Sourced from go.mongodb.org/mongo-driver's releases.

    MongoDB Go Driver 1.11.1

    The MongoDB Go Driver Team is pleased to release version 1.11.1 of the official Go driver.

    Release Notes

    This release contains a bug fix for heartbeat buildup with streaming protocol when the Go driver process is paused in an FAAS environment (e.g. AWS Lambda). This release also includes a bug fix for handling sequential "NoWritesPerformed" labeled operation errors, in that they should still return the "previous indefinite error".

    P.S. We want to hear about how Go developers use MongoDB and the MongoDB Go Driver! If you haven't already, please take the 2022 MongoDB Go Developer Survey.


    For a full list of tickets included in this release, please see the links below:

    Documentation for the Go driver can be found on pkg.go.dev and the MongoDB documentation site. BSON library documentation is also available on pkg.go.dev. Questions and inquiries can be asked on the MongoDB Developer Community. Bugs can be reported in the Go Driver project in the MongoDB JIRA where a list of current issues can be found. Your feedback on the Go driver is greatly appreciated!

    Commits
    • 88c138b Update version to v1.11.1
    • 1f525ec Merge branch 'release/1.11' of github.com:mongodb/mongo-go-driver into releas...
    • fc7ebbb Revert "Release/1.11 (#1146)"
    • bf833d5 Release/1.11 (#1146)
    • cd79115 resolve merge conflicts
    • ed484be GODRIVER-2577 Retry heartbeat on timeout to prevent pool cleanup in FAAS paus...
    • 30805e4 GODRIVER-2333 Assert that Ping op succeeds initial DNS spec tests (#1124)
    • 19f3fb9 GODRIVER-2651 Break NoWritesPerformed-Only Error Sequence (#1135)
    • 4803b59 Update version to v1.11.1-prerelease
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/nats-io/nats.go from 1.20.0 to 1.21.0

    chore(deps): bump github.com/nats-io/nats.go from 1.20.0 to 1.21.0

    Bumps github.com/nats-io/nats.go from 1.20.0 to 1.21.0.

    Release notes

    Sourced from github.com/nats-io/nats.go's releases.

    Release v1.21.0

    Changelog

    Added

    • ConnectHandler connect option to detect that initial connection was established. This is especially useful when combined with RetryOnFailedConnect (#1133 )
    • IgnoreAuthErrorAbort connect option to prevent aborting reconnect attempts after receiving the same authentication error twice (#1141)
    • SkipTLSHandshake option to CustomDialer. SkipTLSHandshake method can be implemented on a custom dialer to prevent TLS handshake if not needed (#1147)
    • KV:
      • Return ErrKeyExists error when attempting to Create() a KV pair for an existing key (#1135, #1136)
    • JetStream:
      • Add ErrLeadershipChanged error, returned when consumer leadership has changed during a pull request on a consumer. Thanks to @​sata-form3 for the contribution (#1151)

    Improved

    • Remove deprecated usages of io/ioutil. Thanks to @​cesarvspr for the contribution (#1150)
    • Remove experimental notice from KV implementation (#1154)

    Complete Changes

    https://github.com/nats-io/nats.go/compare/v1.20.0...v1.21.0

    Commits
    • 6c6add8 Release v1.21.0 (#1156)
    • 7ca331a chore: remove deprecated usage of "io/ioutil" (#1150)
    • 8241797 Remove experimental notice from KeyValue (#1154)
    • af3503a Merge pull request #1151 from sata-form3/sata-create-consumer-leadership-chan...
    • b2ad744 PR Review feedback
    • a52a9ec Provide a way to handle 409 Leadership Changed errors in client
    • 907b219 Merge pull request #1147 from nats-io/custom-dialer-skip-tls
    • 65b7870 Add SkipTLSHandshake small interface to CustomDialer
    • c9b2fd8 This adds an option to skip the TLS connection wrapper
    • 398a1ec [ADDED] IgnoreAuthErrorAbort option on Connect (#1141)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump google.golang.org/grpc from 1.50.1 to 1.51.0

    chore(deps): bump google.golang.org/grpc from 1.50.1 to 1.51.0

    Bumps google.golang.org/grpc from 1.50.1 to 1.51.0.

    Release notes

    Sourced from google.golang.org/grpc's releases.

    Release 1.51.0

    Behavior Changes

    • xds: NACK EDS resources with duplicate addresses in accordance with a recent spec change (#5715)
    • grpc: restrict status codes that can be generated by the control plane (gRFC A54) (#5653)

    New Features

    • client: set grpc-accept-encoding header with all registered compressors (#5541)
    • xds/weightedtarget: return a more meaningful error when all child policies are in TRANSIENT_FAILURE (#5711)
    • gcp/observability: add "started rpcs" metric (#5768)
    • xds: de-experimentalize the google-c2p-resolver (#5707)
    • balancer: add experimental Producer types and methods (#5669)
    • orca: provide a way for LB policies to receive OOB load reports (#5669)

    Bug Fixes

    • go.mod: upgrade x/text dependency to address CVE 2022-32149 (#5769)
    • client: fix race that could lead to an incorrect connection state if it was closed immediately after the server's HTTP/2 preface was received (#5714)
    • xds: ensure sum of the weights of all EDS localities at the same priority level does not exceed uint32 max (#5703)
    • client: fix binary logging bug which logs a server header on a trailers-only response (#5763)
    • balancer/priority: fix a bug where unreleased references to removed child policies (and associated state) was causing a memory leak (#5682)
    • xds/google-c2p: validate URI schema for no authorities (#5756)
    Commits
    • eeb9afa Change version to 1.51.0 (#5782)
    • 72812fe gcp/observability: filter logging from cloud ops endpoints calls (#5765)
    • 0ae33e6 xdsclient: remove unused test code (#5772)
    • 824f449 go.mod: upgrade x/text to v0.4 to address CVE (#5769)
    • 7f23df0 xdsclient: switch xdsclient watch deadlock test to e2e style (#5697)
    • 32f969e o11y: Added started rpc metric in o11y plugin (#5768)
    • b597a8e xdsclient: improve authority watchers test (#5700)
    • e41e894 orca: create ORCA producer for LB policies to use to receive OOB load reports...
    • 36d14db Fix binary logging bug which logs a server header on a trailers only response...
    • fcb8bdf xds/google-c2p: validate url for no authorities (#5756)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/nats-io/nats.go from 1.19.1 to 1.20.0

    chore(deps): bump github.com/nats-io/nats.go from 1.19.1 to 1.20.0

    Bumps github.com/nats-io/nats.go from 1.19.1 to 1.20.0.

    Release notes

    Sourced from github.com/nats-io/nats.go's releases.

    Release v1.20.0

    Changelog

    Changed

    • JetStream:
      • [BREAKING CHANGE] Extract nats: Consumer Deleted server error to ErrConsumerDeleted variable. This error is returned when consumer is deleted while waiting on pull request and was introduced in nats-server v2.9.6 (#1125)

    Improved

    • JetStream:
      • Fix broken comments on ErrConsumerNameAlreadyInUse and StreamNameBySubject(). Thanks to @​subtle-byte for the contribution (#1128)
    • Core NATS:
      • Improve comment on RetryOnFailedConnect connect option (#1127)

    Complete Changes

    https://github.com/nats-io/nats.go/compare/v1.19.1...v1.20.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/nats-io/nats.go from 1.19.0 to 1.19.1

    chore(deps): bump github.com/nats-io/nats.go from 1.19.0 to 1.19.1

    Bumps github.com/nats-io/nats.go from 1.19.0 to 1.19.1.

    Release notes

    Sourced from github.com/nats-io/nats.go's releases.

    Release v1.19.1

    Changelog

    Added

    • JetStream:
      • Expose StreamNameBySubject method on JetStreamContext interface for looking up stream by subject (#1114)
      • Return stream alternates when fetching stream info (#1118)

    Changed

    • KV:
      • Use BindStream for watcher so it works with mirrors (#1116)

    Fixed

    • KV:
      • Delete key not working correctly across mirrors (#1115)

    Complete Changes

    https://github.com/nats-io/nats.go/compare/v1.19.0...v1.19.1

    Commits
    • 980f955 Release v1.19.1 (#1123)
    • fbeee79 Merge pull request #1118 from nats-io/stream-alternates
    • 6bd7837 Support stream alternates
    • e227e17 Merge pull request #1116 from nats-io/kv-mirror-watcher
    • 416c895 Use BindStream for watcher so it works with mirrors.
    • 48285d7 Merge pull request #1115 from nats-io/kv-mirror-fix-delete
    • 7ac1087 [CHANGED] Make lookupStreamBySubject public (#1114)
    • 9d7afb4 [FIX] KV delete not working correctly accross mirrors
    • 6e4828a Merge pull request #1113 from nats-io/release/v1.19.0
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump go.mongodb.org/mongo-driver from 1.10.3 to 1.11.0

    chore(deps): bump go.mongodb.org/mongo-driver from 1.10.3 to 1.11.0

    Bumps go.mongodb.org/mongo-driver from 1.10.3 to 1.11.0.

    Release notes

    Sourced from go.mongodb.org/mongo-driver's releases.

    MongoDB Go Driver 1.10.4

    The MongoDB Go Driver Team is pleased to release version 1.10.4 of the official Go driver.

    Release Notes

    This release contains several bugfixes. One of the bugfixes removes a severe bug in SRV polling which may prevent changes in SRV records from updating the servers that the Go Driver attempts to connect to when the MongoDB connection string includes a username and password.


    For a full list of tickets included in this release, please see the links below:

    Documentation for the Go driver can be found on pkg.go.dev and the MongoDB documentation site. BSON library documentation is also available on pkg.go.dev. Questions and inquiries can be asked on the MongoDB Developer Community. Bugs can be reported in the Go Driver project in the MongoDB JIRA where a list of current issues can be found. Your feedback on the Go driver is greatly appreciated!

    Commits
    • ea2a55c Update version to v1.11.0
    • 1123dac GODRIVER-1530 GODRIVER-1213 Fix the enterprise auth test runner. (#1118)
    • 7586dd7 GODRIVER-2621 use batchtime for fuzz tests (#1117)
    • 9567271 GODRIVER-2631 - Always close internal.DefaultHTTPClient on Client.Disconnect ...
    • 4a22ce6 GODRIVER-2050 - Add settable http.Clients and gracefully close provided defau...
    • edfc51c GODRIVER-2565 Abort transaction before CommitLoop if context errored. (#1101)
    • e4853fb GODRIVER-2620 Fix hostname parsing for SRV polling. (#1112)
    • f5312df GODRIVER-2487 No useMultipleMongoses false in findOneAndUpdate errorResponse ...
    • 423be54 GODRIVER-2174 Bump minimum Go version to 1.13. (#1100)
    • 39194dd GODRIVER-2604 Add ErrServerSelectionTimeout and WaitQueueTimeoutError to ...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Google PubSub backend implementation for the event.Bus

    Google PubSub backend implementation for the event.Bus

    Summary

    Provide an Event Bus backend implementation backed by Google PubSub event broker.

    Motivation

    We are deploying our application GCE and we need an event bus to publish events so the application can use an event driven architecture. One of the uses is as for Event Sourcing and to allow the projectors to see events from aggregates.

    We evaluated Google PubSub and saw that it supports Event Ordering. An event can provide an Ordering Key and the infrastructure will warrant the events for the same Ordering Key will be provided in order. Our intent is to use the Aggregate ID as the ordering key.

    Proposal

    The idea is to implement the event.Bus interface using the cloud.google.com/go/pubsub package. This implementation will take the nats.bus implementation as a base.

    Using topicFunc (like subjectFunc in nats implementation), all events of a given aggregate type can be published on the same PubSub topic.

    Also the Aggregate ID in the event can be used as an Ordering Key.

    Note

    I'm using this implementation to learn about goes and its capabilities. Any suggestion or guidence us wellcome.

  • Query Cache

    Query Cache

    Implement a flexible cache for event queries.

    Features

    • Automatic cache key based on the query filters
    • Time-based and manual expiry
    • Optional cache storage

    Examples

    Basic usage

    package example
    
    import (
      "github.com/modernice/goes/event"
      "github.com/modernice/goes/event/query"
    )
    
    func example(store event.Store, q event.Query) {
      cache := query.NewCache(store)
    
      result, err := cache.Result(context.TODO(), q)
      // handle err
    
      if result.Cached {
        log.Println("cache returned cached result")
      } else {
        log.Println("cache executed query")
      }
    
      events, err := streams.Drain(context.TODO(), result.Events, result.Errs)
      // handle err
    
      // alternatively
    
      str, errs, err := cache.Run(context.TODO(), q)
      // handle err
    
      events, err := streams.Drain(context.TODO(), str, errs)
    }
    
  • [contrib/auth] Add `QueryClient.Roles()` method

    [contrib/auth] Add `QueryClient.Roles()` method

    Allow querying of user roles:

    package example
    
    func example(client auth.QueryClient) {
      userID := uuid.New()
      roleIDs, roleNames, err := client.RolesOf(context.TODO(), userID)
    }
    
  • Projection finalizers

    Projection finalizers

    Currently, projection finalization is implemented like this:

    package example
    
    type Foo struct { ... }
    
    func (*Foo) ApplyEvent(event.Event) {}
    
    func (f *Foo) finalize(ctx context.Context, dep SomeDependency) error {
      // do stuff
      if err := dep.Do(ctx, "..."); err != nil {
        return err
      }
      // do more stuff
      return nil
    }
    
    func example(s projection.Schedule) {
      var dep SomeDependency
    
      s.Subscribe(context.TODO(), func(ctx projection.Job) error {
        refs, errs, err := ctx.Aggregates(ctx)
        if err != nil {
          return fmt.Errorf("extract aggregates: %w", err)
        }
    
        return streams.Walk(ctx, func(ref aggregate.Ref) error {
          foo := NewFoo(ref.ID)
    
          if err := ctx.Apply(ctx, foo); err != nil {
            return err
          }
    
          return foo.finalize(ctx, dep)
        }, refs, errs)
      })
    }
    

    Finalization is done for each individual projection after the job applies its events. A nice addition would be if finalization could be batched and deferred to the end of the projection job, like this:

    package example
    
    func example(s projection.Schedule) {
      var dep SomeDependency
    
      s.Subscribe(context.TODO(), func(ctx projection.Job) error {
        refs, errs, err := ctx.Aggregates(ctx)
        if err != nil {
          return fmt.Errorf("extract aggregates: %w", err)
        }
    
        return streams.Walk(ctx, func(ref aggregate.Ref) error {
          foo := NewFoo(ref.ID)
    
          if err := ctx.Apply(ctx, foo); err != nil {
            return err
          }
    
          return ctx.Defer(func() error {
            // this call will be deferred to after this projection update
            return foo.finalize(ctx, dep)
          })
        }, refs, errs)
      })
    }
    
  • Concurrent command handling

    Concurrent command handling

    Add options to enable concurrent command handling.

    Standalone command handler

    package example
    
    func example(bus command.Bus) {
      h := command.NewHandler(bus)
    
      h.Handle(context.TODO(), "foo", func(ctx command.Context) error { ... }, command.Workers(4))
    }
    

    Aggregate-based command handler

    package example
    
    type Foo struct {
      *aggregate.Base
      *handler.BaseHandler
    }
    
    func NewFoo(id uuid.UUID) *Foo { ... }
    
    func example(bus command.Bus, repo aggregate.Repository) {
      h := handler.New(NewFoo, repo, bus)
    
      h.Handle(context.TODO(), command.Workers(4))
    }
    
  • How to use `SoftRestorer`?

    How to use `SoftRestorer`?

    Problem

    When the event stream of an aggregate contains a SoftDeleter event, the aggregate can neither be queried nor fetched from the aggregate repository. How can an aggregate be restored if it cannot be fetched to raise the SoftRestorer event?

    Example

    package example
    
    type RestoredEvent struct {}
    
    func (RestoredEvent) SoftRestore() bool { return true }
    
    func example(repo aggregate.Repository) {
      var foo aggregate.Aggregate // soft-deleted aggregate
    
      if err := repo.Fetch(context.TODO(), foo); err != nil {
        // fails with repository.ErrDeleted
      }
    
      // we want to do this
      aggregate.Next(foo, "restored", RestoredEvent{})
      repo.Save(context.TODO(), foo)
    }
    

    Proposal – context.Context API

    The repository package could provide a "hidden" API using context.Context.WithValue() to disable soft-deletion checks:

    package example
    
    func example(repo aggregate.Repository) {
      var foo aggregate.Aggregate
    
      ctx := repository.WithSoftDeleted(context.TODO())
    
      repo.Fetch(ctx, foo)
      aggregate.Next(foo, "restored", RestoredEvent{})
      repo.Save(context.TODO(), foo)
    }
    

    Drawbacks

    • hiding options behind a Context is considered bad design
Build event-driven and event streaming applications with ease

Commander ?? Commander is Go library for writing event-driven applications. Enabling event sourcing, RPC over messages, SAGA's, bidirectional streamin

Dec 19, 2022
Event-planning-go - GRAPHQL Project for Event Planning

About The Project GRAPHQL Project for Event Planning Building the project with l

Mar 13, 2022
Go gRPC Kafka CQRS microservices with tracing

Golang CQRS Kafka gRPC Postgresql MongoDB Redis microservices example ?? ??‍?? Full list what has been used: Kafka as messages broker gRPC Go implemen

Jan 1, 2023
:incoming_envelope: A fast Message/Event Hub using publish/subscribe pattern with support for topics like* rabbitMQ exchanges for Go applications

Hub ?? A fast enough Event Hub for go applications using publish/subscribe with support patterns on topics like rabbitMQ exchanges. Table of Contents

Dec 17, 2022
Easy to use distributed event bus similar to Kafka
Easy to use distributed event bus similar to Kafka

chukcha Easy to use distributed event bus similar to Kafka. The event bus is designed to be used as a persistent intermediate storage buffer for any k

Dec 30, 2022
Simple, high-performance event streaming broker

Styx Styx is a simple and high-performance event streaming broker. It aims to provide teams of all sizes with a simple to operate, disk-persisted publ

Nov 24, 2022
Discrete-event simulation in Go using goroutines

SimGo SimGo is a discrete event simulation framework for Go. It is similar to SimPy and aims to be easy to set up and use. Processes are defined as si

Sep 6, 2022
Simple synchronous event pub-sub package for Golang

event-go Simple synchronous event pub-sub package for Golang This is a Go language package for publishing/subscribing domain events. This is useful to

Jun 16, 2022
pubsub controller using kafka and base on sarama. Easy controll flow for actions streamming, event driven.

Psub helper for create system using kafka to streaming and events driven base. Install go get github.com/teng231/psub have 3 env variables for config

Sep 26, 2022
POC of an event-driven Go implementation

Event Driven example in Golang This POC shows an example of event-driven architecture with a working domain event broker, an event producer and a cons

Nov 2, 2021
Go library to build event driven applications easily using AMQP as a backend.

event Go library to build event driven applications easily using AMQP as a backend. Publisher package main import ( "github.com/creekorful/event" "

Dec 5, 2021
Example Golang Event-Driven with kafka Microservices Choreography

Microservices Choreography A demonstration for event sourcing using Go and Kafka example Microservices Choreography. To run this project: Install Go I

Dec 2, 2021
A basic event queue (and publisher/subscriber) in go

queue A basic event queue (and publisher/subscriber) in go. Installation go get github.com/jimjibone/queue Queue Usage Queue is a channel-based FIFO q

Dec 17, 2021
Basic Event Streaming - Fundamentals of Kafka Studies (BESt-FunKS)

Apache Kafka My study repo for Apache Kafka. Based on this tutorial. Contents Overview Key Terms Event Topic Producer Consumer Partition Getting Start

Mar 2, 2022
A lightweight event collection system.
A lightweight event collection system.

Honeypot A self-contained, multi-protocol streaming event collection system with ambitions to be as boring as benthos. Honeypot is primarily built for

Dec 6, 2022
socket.io library for golang, a realtime application framework.

go-socket.io go-socket.io is library an implementation of Socket.IO in Golang, which is a realtime application framework. Current this library support

Jan 8, 2023
:notes: Minimalist websocket framework for Go
:notes: Minimalist websocket framework for Go

melody ?? Minimalist websocket framework for Go. Melody is websocket framework based on github.com/gorilla/websocket that abstracts away the tedious p

Dec 30, 2022
Kafka, Beanstalkd, Pulsar Pub/Sub framework

go-queue Kafka, Beanstalkd, Pulsar Pub/Sub framework.

Sep 17, 2022
Idiomatic Event Sourcing in Go
Idiomatic Event Sourcing in Go

Event Sourcing for Go Idiomatic library to help you build Event Sourced application in Go. Please note The library is currently under development and

Oct 27, 2022
A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes
A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes

A pluggable "Application State Gateway" that enforces the Event Sourcing Pattern for securely persisting & broadcasting application state ch

Nov 1, 2022