{"id":34144646,"url":"https://github.com/honestbank/event-driver","last_synced_at":"2026-03-12T19:33:33.627Z","repository":{"id":218116259,"uuid":"745647423","full_name":"honestbank/event-driver","owner":"honestbank","description":"Org-wise framework library in golang, for managing and handling events in applications.","archived":false,"fork":false,"pushed_at":"2026-02-24T07:59:25.000Z","size":191,"stargazers_count":9,"open_issues_count":3,"forks_count":1,"subscribers_count":12,"default_branch":"main","last_synced_at":"2026-02-24T13:53:10.298Z","etag":null,"topics":["backend","workspace-code-infrastructure-prod"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/honestbank.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-19T19:37:43.000Z","updated_at":"2025-02-18T06:34:32.000Z","dependencies_parsed_at":"2024-04-20T08:23:50.124Z","dependency_job_id":"237b3b25-676e-4641-87b0-0b0a3ee43451","html_url":"https://github.com/honestbank/event-driver","commit_stats":null,"previous_names":["keludiao/event-driver","lukecold/event-driver","honestbank/event-driver"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/honestbank/event-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honestbank%2Fevent-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honestbank%2Fevent-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honestbank%2Fevent-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honestbank%2Fevent-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/honestbank","download_url":"https://codeload.github.com/honestbank/event-driver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honestbank%2Fevent-driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30439916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","workspace-code-infrastructure-prod"],"created_at":"2025-12-15T03:56:04.123Z","updated_at":"2026-03-12T19:33:33.618Z","avatar_url":"https://github.com/honestbank.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Event Driver\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/honestbank/event-driver.svg)](https://pkg.go.dev/github.com/honestbank/event-driver)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/honestbank/event-driver)\n![GitHub Release](https://img.shields.io/github/v/release/honestbank/event-driver)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=honestbank_event-driver\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=honestbank_event-driver)\n![Sonar Coverage](https://img.shields.io/sonar/coverage/honestbank_event-driver?server=https%3A%2F%2Fsonarcloud.io)\n\nEvent Driver is a lightweight and flexible event-driven programming framework for managing and handling events in your applications. It provides a simple and intuitive API to facilitate communication between different components or modules in your software.\n\n# Table of Contents\n1. [Features](#Features)\n2. [Tutorial](#Tutorial)\n   1. [Steps Break Down](#Steps-Break-Down)\n   2. [Example Code](#Example-Code)\n3. [Extensions](#Extensions)\n   1. [Cloud Events](#Cloud-Events)\n   2. [Google Cloud](#Google-Cloud)\n\n## Features\n\n- **Event-driven Architecture**: Easily implement an event-driven architecture in your application.\n- **Custom Handlers**: Define and dispatch custom handlers tailored to your application's needs.\n- **Pipeline Structure**: Simply put your handlers in order and expect it to work like a pipeline.\n- **Asynchronous Support**: Handle events asynchronously for improved performance and responsiveness.\n- **Lightweight and Easy to Use**: Minimal dependencies and quick integration \u0026 usage.\n\n## Tutorial\n\nThis tutorial is in the format of a case study of a real-world service.\n\nThere's an event-driven service that processes orders when `event1` happens,\nbut the processing logic only uses data from `event2` and `event3`.\nThis service needs to\n1. be fault-tolerant (shouldn't crash at errors, and should be able to recover fast when crash does happen)\n2. be idempotent (not processing duplicate orders)\n\n### Steps Break Down\n1. Let's start with joining the events. Create a joiner that makes a join when all required events are present.\n   ```golang\n   myJoiner := joiner.New(joiner.MatchAll(\"event1\", \"event2\", \"event3\"), myEventStore)\n   ```\n2. The event joiner that we just created requires an event store for lookups.\n   Here we pick GCS rather than the in-memory store to avoid losing data at restart.\n   ```golang\n   gcsTimeout := time.Second * 5 // tune the timeout that fits your content size\n   gcsConfig := gcs_event_store.Config(\"my-bucket\").\n       WithTimeout(gcs_event_store.Timeout{Default: \u0026gcsTimeout}) // can also specify finer timeout for each operation\n   // Create a GCS event store without authentication just for showcase.\n   myEventStore, err := gcs_event_store.New(ctx, gcsConfig, option.WithoutAuthentication())\n   ```\n3. Create a cache for idempotency.\n   The cache stores the events under the same GCS bucket as joiner (beware of source name conflict between them).\n\n   The cache achieves idempotency by skipping the process (i.e. not passing result to the next handler) on key conflict.\n   ```golang\n   idempotencyHandler := cache.New(myEventStore, cache.SkipOnConflict())\n   ```\n4. It would also be great if we can just ignore the content from `event1` to save\n   both GCS storage and the network bandwidth \u0026 memory of service pod.\n   ```golang\n   eraseContentOfEvent1 := transformer.EraseContentFromSources(\"event1\")\n   eraseContentOfEvent1Handler := transformer.New(eraseContentOfEvent1)\n   ```\n5. Now we need to build a customized handler to handle the business logic.\n   ```golang\n   package business_handler\n\n   import (\n       \"github.com/honestbank/event-driver/handlers\"\n   )\n\n   type MyInput struct {\n       event2 Event2Type `json:\"event2\"`\n       event3 Event3Type `json:\"event3\"`\n   }\n\n   type myHandler struct {\n       config Config\n   }\n\n   func New(config Config) handlers.Handler {\n       return \u0026myHandler{\n           config: config,\n       }\n   }\n\n   func (c *myHandler) Process(ctx context.Context, in *event.Message, next handlers.CallNext) error {\n       var myInput MyInput\n       if err := json.UnMarshal(in.GetContent(), \u0026myInput); err != nil {\n           return err\n       }\n       if err = handlesBusinessLogic(myInput, c.config); err != nil {\n           return err\n       }\n\n       return next.Call(ctx, in) // can omit if this is already the last handler\n   }\n   ```\n6. Build a pipeline with the handlers\n   ```golang\n   myPipeline := pipeline.New().\n       WithNextHandler(eraseContentOfEvent1Handler). // remove the content of event1 before joining\n       WithNextHandler(myJoiner).                    // join all events of the same key into a single message\n       WithNextHandler(idempotencyHandler).          // check for idempotency after a joint message is formed\n       WithNextHandler(businessHandler)              // handles the business logic\n   ```\n7. Start serving traffic!\n   ```golang\n   // Showcasing converting the pipeline into KNative cloud events handler\n   // One can also use sarama/confluentic kafka, Google Cloud function, etc.\n   handleKNativeEvent := convert.ToKNativeEventHandler(\n       convert.CloudEventToInput,\n       myPipeline,\n       convert.OutputToCloudResult)\n   cloudEventClient.StartReceiver(ctx, handleKNativeEvent) // assume cloudEventClient is already created\n   ```\n\n### Example Code\nNow assemble the step break-downs above to an example code\n\n```golang\npackage main\n\nimport (\n   \"context\"\n   \"log\"\n   \"time\"\n\n   \"google.golang.org/api/option\"\n\n   \"github.com/honestbank/event-driver/event\"\n   \"github.com/honestbank/event-driver/extensions/cloudevents/convert\"\n   \"github.com/honestbank/event-driver/extensions/google-cloud/storage/gcs_event_store\"\n   \"github.com/honestbank/event-driver/handlers/cache\"\n   \"github.com/honestbank/event-driver/handlers/joiner\"\n   \"github.com/honestbank/event-driver/handlers/transformer\"\n   \"github.com/honestbank/event-driver/pipeline\"\n   \"github.com/honestbank/event-driver/storage\"\n)\n\nfunc main() {\n    ctx := context.Background()\n    eraseContentOfEvent1 := transformer.EraseContentFromSources(\"event1\")\n    eraseContentOfEvent1Handler := transformer.New(eraseContentOfEvent1)\n    myEventStore, err := createEventStore(ctx)\n    if err != nil {\n        log.Panic(\"failed to create GCS event store\", err)\n    }\n    myJoiner := joiner.New(joiner.MatchAll(\"event1\", \"event2\", \"event3\"), myEventStore)\n    idempotencyHandler := cache.New(myEventStore, cache.SkipOnConflict())\n    businessHandler := business_handler.New()\n\n    myPipeline := pipeline.New().\n        WithNextHandler(eraseContentOfEvent1Handler). // remove the content of event1 before joining\n        WithNextHandler(myJoiner).                    // join all events of the same key into a single message\n        WithNextHandler(idempotencyHandler).          // check for idempotency after a joint message is formed\n        WithNextHandler(businessHandler)              // handles the business logic\n\n    // Showcasing converting the pipeline into KNative cloud events handler\n    // One can also use sarama/confluentic kafka, Google Cloud function, etc.\n    handleKNativeEvent := convert.ToKNativeEventHandler(\n        convert.CloudEventToInput,\n        myPipeline,\n        convert.OutputToCloudResult)\n    cloudEventClient.StartReceiver(ctx, handleKNativeEvent) // assume cloudEventClient is already created\n}\n\nfunc createEventStore(ctx context.Context) (storage.EventStore, error) {\n    gcsTimeout := time.Second * 5 // tune the timeout that fits your content size\n    gcsConfig := gcs_event_store.Config(\"my-bucket\").\n        WithTimeout(gcs_event_store.Timeout{Default: \u0026gcsTimeout}) // can also specify finer timeout for each operation\n\n    // Create a GCS event store without authentication just for showcase.\n    return gcs_event_store.New(ctx, gcsConfig, option.WithoutAuthentication())\n}\n```\n\n## Extensions\nEvent Driver also provides the following libs for integrating with other services/frameworks as extensions.\n\n### Cloud Events\n\nLink: [github.com/honestbank/event-driver/extensions/cloudevents](https://github.com/honestbank/event-driver/tree/main/extensions/cloudevents)\n\nIntegrate event driver with [Cloud Events](github.com/cloudevents/sdk-go/v2),\ni.e. providing a converter that converts the event driver pipeline into a cloud events handler.\nCheck the [document](https://github.com/honestbank/event-driver/tree/main/extensions/cloudevents/README.md)\nto see what is currently supported and the latest update.\n\n### Google Cloud\n\nLink: [github.com/honestbank/event-driver/extensions/google-cloud](https://github.com/honestbank/event-driver/tree/main/extensions/google-cloud)\n\nIntegrate event driver with Google Cloud, including using GCS/BigQuery as event store,\nintegrating the event driver pipeline with Cloud Functions, etc.\nCheck the [document](https://github.com/honestbank/event-driver/tree/main/extensions/google-cloud/README.md)\nto see what is currently supported and the latest update.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonestbank%2Fevent-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonestbank%2Fevent-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonestbank%2Fevent-driver/lists"}