{"id":24791487,"url":"https://github.com/sofyan48/pubsub-router","last_synced_at":"2026-02-10T20:02:31.827Z","repository":{"id":56789146,"uuid":"524941275","full_name":"sofyan48/pubsub-router","owner":"sofyan48","description":"Route your action in gcp Pubsub easy","archived":false,"fork":false,"pushed_at":"2025-06-10T06:43:38.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-22T05:39:15.728Z","etag":null,"topics":["events","gcp","go","golang","mq","publisher","pubsub","router","routes","subscriber"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofyan48.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":".github/code_of_conduct.md","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,"zenodo":null}},"created_at":"2022-08-15T10:19:13.000Z","updated_at":"2025-06-10T06:43:04.000Z","dependencies_parsed_at":"2025-08-22T05:30:10.473Z","dependency_job_id":null,"html_url":"https://github.com/sofyan48/pubsub-router","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sofyan48/pubsub-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fpubsub-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fpubsub-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fpubsub-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fpubsub-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofyan48","download_url":"https://codeload.github.com/sofyan48/pubsub-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fpubsub-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29314703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T17:48:59.043Z","status":"ssl_error","status_checked_at":"2026-02-10T17:45:37.240Z","response_time":65,"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":["events","gcp","go","golang","mq","publisher","pubsub","router","routes","subscriber"],"created_at":"2025-01-29T19:17:14.353Z","updated_at":"2026-02-10T20:02:31.788Z","avatar_url":"https://github.com/sofyan48.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP PubSub Router\n[![Pubsub Router Local Development](https://github.com/sofyan48/pubsub-router/actions/workflows/docker-image.yml/badge.svg?branch=master)](https://github.com/sofyan48/pubsub-router/actions/workflows/docker-image.yml)\n---\nRoute your action in gcp Pubsub easy\n\n## Installing\n```\ngo get github.com/sofyan48/pubsub-router\n```\n\n### Setup Client \n``` Golang\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"cloud.google.com/go/pubsub\"\n\t\"github.com/joho/godotenv\"\n\tpubsubrouter \"github.com/sofyan48/pubsub-router\"\n)\n\nfunc main() {\n\terr := godotenv.Load()\n\tif err != nil {\n\t\tfmt.Println(\"error: \", err)\n\t}\n\tcfg := \u0026pubsubrouter.Config{\n\t\tType:                    \"service_account\",\n\t\tProjectID:               os.Getenv(\"GOOGLE_PROJECT_ID\"),\n\t\tPrivateKeyID:            os.Getenv(\"GOOGLE_PRIVATE_KEY_ID\"),\n\t\tPrivateKey:              os.Getenv(\"GOOGLE_PRIVATE_KEY\"),\n\t\tClientEmail:             os.Getenv(\"GOOGLE_CLIENT_EMAIL\"),\n\t\tClientID:                os.Getenv(\"GOOGLE_CLIENT_ID\"),\n\t\tAuthURI:                 os.Getenv(\"GOOGLE_AUTH_URI\"),\n\t\tTokenURI:                os.Getenv(\"GOOGLE_TOKEN_URI\"),\n\t\tAuthProviderX509CertURL: os.Getenv(\"GOOGLE_AUTH_PROVIDER\"),\n\t\tClientX509CertURL:       os.Getenv(\"GOOGLE_CLIENT_CERT_URL\"),\n\t}\n\tsv := pubsubrouter.NewServer(context.Background(), cfg)\n}\n\n```\n### Setup Handler \n``` Golang\n\nfunc handlerMessage() HandlerFunc {\n\treturn func(m *pubsubrouter.Message) error error {\n\t\tfmt.Println(\"FROM EVENT:\u003e \", string(m.Data))\n\t\treturn nil\n\t}\n}\n\nfunc handlerMessage2() HandlerFunc {\n\treturn func(m *pubsubrouter.Message) error {\n\t\tfmt.Println(\"FROM TEST:\u003e \", string(m.Data))\n\t\treturn nil\n\t}\n}\n```\n\n### Setup Router and Handler\n``` Golang\n\t// add router\n\trtr := pubsubrouter.NewRouter()\n\t\n\t// setup routing and handler\n\trtr.Handle(\"/event\", handlerMessage())\n\trtr.Handle(\"/test\", handlerMessage2())\n\n```\n### Starting Subscriber\n``` Golang\n\tsv.Subscribe(os.Getenv(\"EVENT_BROKER_SERIAL\"), rtr).Start()\n```\n### Starting Publisher \nSend event with attribute path\n``` Golang\n\tsv.Publish(os.Getenv(\"EVENT_BROKER_SERIAL\"), \"/test\", \"Message send test\")\n```\n\n## Example\nFor best model example check example folder\n\n```\ngo run example/main.go\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofyan48%2Fpubsub-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofyan48%2Fpubsub-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofyan48%2Fpubsub-router/lists"}