{"id":37152300,"url":"https://github.com/sincolb/eventhub","last_synced_at":"2026-01-14T17:59:09.438Z","repository":{"id":273177776,"uuid":"918911147","full_name":"sincolb/eventhub","owner":"sincolb","description":"A stand-alone version of the event subscription component","archived":false,"fork":false,"pushed_at":"2025-03-07T07:09:50.000Z","size":86,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T08:23:05.243Z","etag":null,"topics":["event","golang","pubsub","subscribe"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/sincolb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T07:38:14.000Z","updated_at":"2025-03-07T07:09:53.000Z","dependencies_parsed_at":"2025-01-19T08:27:38.427Z","dependency_job_id":"cd738e3b-004c-4802-8288-8134263dc812","html_url":"https://github.com/sincolb/eventhub","commit_stats":null,"previous_names":["sincolb/eventhub"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sincolb/eventhub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sincolb%2Feventhub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sincolb%2Feventhub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sincolb%2Feventhub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sincolb%2Feventhub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sincolb","download_url":"https://codeload.github.com/sincolb/eventhub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sincolb%2Feventhub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28429160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["event","golang","pubsub","subscribe"],"created_at":"2026-01-14T17:59:06.602Z","updated_at":"2026-01-14T17:59:09.434Z","avatar_url":"https://github.com/sincolb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eventhub\n\n\u003cdiv align=center\u003e\n\n[![codecov](https://codecov.io/github/sincolb/eventhub/graph/badge.svg?token=VDA3VL01X8)](https://codecov.io/github/sincolb/eventhub)\n[![GoDoc](https://godoc.org/github.com/sincolb/eventhub?status.svg)](https://godoc.org/github.com/sincolb/eventhub)\n[![Go Report Card](https://goreportcard.com/badge/github.com/sincolb/eventhub)](https://goreportcard.com/report/github.com/sincolb/eventhub)\n[![Workflow for Codecov Action](https://github.com/sincolb/eventhub/actions/workflows/go.yml/badge.svg)](https://github.com/sincolb/eventhub/actions/workflows/go.yml)\n\n\u003c/div\u003e\n\n`eventhub` is a stand-alone version of the event subscription component that can accept multiple or one results, and supports timeouts and contexts.\n\n## Install\n```console\ngo get github.com/sincolb/eventhub\n```\n## Usage\n```\n\neventHubTable := eventhub.NewEventHubTable[string]()\ndefer eventHubTable.Stop()\n\neventHubTable.Distribute(\"eventNname\", time.Millisecond*10, \"event data\")\n\ndone := make(chan struct{})\ngo func() {\n\tgot, err := eventHubTable.Subscribe(\"eventNname\", time.Millisecond*100)\n\tfmt.Println(got, err)\n\tdone \u003c- struct{}{}\n}()\n\u003c-done\n```\n### Subscribe only once\n```\nhub := eventhub.NewEventHub()\ndefer hub.Close()\n\ngo func() {\n\tdefer wg.Done()\n\thub.Publish(\u0026struct {\n\t\tName string\n\t}{\n\t\tName: \"title\",\n\t})\n}()\ngot, err := hub.Subscribe(time.Millisecond * 10)\nfmt.Println(got, err)\n```\n### Subscribes for multiple\n```\nhub := NewEventHub()\ndefer hub.Close()\n\ngo func() {\n\tfor i := 0; i \u003c 5; i++ {\n\t\thub.Publish(i, 0)\n\t\t// simulates latency into the eventhub\n\t\ttime.Sleep(time.Millisecond * 10)\n\t}\n}()\nres, err := hub.Subscribes(time.Millisecond*100, 4)\nfmt.Println(res, err)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsincolb%2Feventhub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsincolb%2Feventhub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsincolb%2Feventhub/lists"}