{"id":20961348,"url":"https://github.com/perbu/mkafka","last_synced_at":"2026-04-20T20:32:02.474Z","repository":{"id":143067716,"uuid":"610276426","full_name":"perbu/mkafka","owner":"perbu","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-06T13:14:51.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T06:44:10.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perbu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-03-06T13:01:16.000Z","updated_at":"2023-03-06T13:06:55.000Z","dependencies_parsed_at":"2023-04-27T16:47:02.645Z","dependency_job_id":null,"html_url":"https://github.com/perbu/mkafka","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/perbu/mkafka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fmkafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fmkafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fmkafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fmkafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perbu","download_url":"https://codeload.github.com/perbu/mkafka/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fmkafka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28061254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-19T02:03:26.607Z","updated_at":"2025-12-26T21:15:28.870Z","avatar_url":"https://github.com/perbu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mkafka\n\nThis package implements a buffered writer for Kafka. It'll try to write to Kafka asynchronously, \nand if it fails, it'll retry until it succeeds. It'll persist the in the buffer until it succeeds.\n\nIt uses the amazing franz-go package to do the heavy lifting.\n\n## Things to note:\n\nWriting should never fail. If kafka fails, the module will buffer.\n\nRun() will block until the context is cancelled. On context cancel, it'll flush the buffer, if this fails then\nit'll return an error, so be sure to check the error.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"github.com/perbu/mkafka\"\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\t\"sync\"\n)\n\nfunc main() {\n\t// create a client.\n\tclient, err := mkafka.New()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)\n\tdefer cancel()\n\twg := \u0026sync.WaitGroup{}\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t// write to kafka, will always succeed\n\t\terr := client.Run(ctx)\n\t\tif err != nil {\n\t\t\tlog.Println(\"client.Run() failed:\", err)\n\t\t}\n\t}()\n\t// write to kafka, will always succeed\n\terr = client.Write(ctx, \"test\", []byte(\"hello world\"))\n\tif err != nil {\n        log.Println(\"client.Write() failed:\", err)\n    }\n\tcancel()\n\twg.Wait()\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fmkafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperbu%2Fmkafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fmkafka/lists"}