{"id":49829728,"url":"https://github.com/vatsal278/msgbroker","last_synced_at":"2026-05-13T20:31:58.972Z","repository":{"id":49849229,"uuid":"516021242","full_name":"vatsal278/msgbroker","owner":"vatsal278","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-15T10:43:14.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T06:21:54.934Z","etag":null,"topics":["api","docker","golang","gorilla-mux","message-broker","message-broker-server","message-queue","pubsub","rsa-cryptography","rsa-key"],"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/vatsal278.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-07-20T14:45:50.000Z","updated_at":"2022-08-30T11:32:00.000Z","dependencies_parsed_at":"2024-06-20T05:38:40.592Z","dependency_job_id":"0c5b0f87-f500-426c-b254-45869f657133","html_url":"https://github.com/vatsal278/msgbroker","commit_stats":{"total_commits":127,"total_committers":2,"mean_commits":63.5,"dds":0.007874015748031482,"last_synced_commit":"1030b8fbca5a120403e9871ba40b3799aa418b50"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/vatsal278/msgbroker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatsal278%2Fmsgbroker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatsal278%2Fmsgbroker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatsal278%2Fmsgbroker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatsal278%2Fmsgbroker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vatsal278","download_url":"https://codeload.github.com/vatsal278/msgbroker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatsal278%2Fmsgbroker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32999213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"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":["api","docker","golang","gorilla-mux","message-broker","message-broker-server","message-queue","pubsub","rsa-cryptography","rsa-key"],"created_at":"2026-05-13T20:31:57.942Z","updated_at":"2026-05-13T20:31:58.957Z","avatar_url":"https://github.com/vatsal278.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Message Broker Service\n\n* This Rest API was created using Golang. It features functions like registering publisher or subscriber, publishing messages or extracting updates.\n* This utilises RSA encryption and the key can be passed to the functions for encryption/decryption, following a required format.\n* This api has used clean code principle \n* This api is completely unit tested and all the errors have been handled\n\n#### Formatting the `RSA key`\n* `RSA key` can be supplied by the user\n* The `RSA public key` follows a specific format that can be obtained by the pkg function\n```\nimport \"github.com/vatsal278/msgbroker/pkg/crypt\"\n.\n.\npubKey := crypt.KeyAsPEMStr(RSA public key)\n//pubKey is the string formating of the RSA public key that will be used for subscriber registration\n```\n## Starting the message broker service\n\n* Running locally : \n```\ngo run cmd/main.go\n```\n* Running via docker :\n```\ndocker build -t msgbrokersvc .\ndocker run -p 9090:9090 msgbrokersvc\n```\n## API Spec\n\nYou can test the api using post man, just import the [collection](./docs/New%20Collection.postman_collection.json) into your postman app.\n\n### Register a Publisher\n- Method: `POST`\n- Path: `/register/publisher`\n- Request Body:\n```\n{\n    \"channel\": \"channel\",\n}\n```\n- Response Header: `HTTP 201`\n- Response Body:\n```\n{\n    \"status\": 201,\n    \"message\": \"Successfully Registered as publisher to the channel\",\n    \"data\": {\n      \"id\": \"Uuid\"\n    }\n}\n```\n\n### Register a subscriber\n- Method: `POST`\n- Path: `/register/subscriber`\n- Request Body:\n```\n{\n    \"callback\":{\n          \"httpmethod\":\"POST\",\n          \"callbackUrl\":\"URL\",\n          \"key\":\"RSA public  key (in pem string format)\"\n    },\n    \"channel\": \"channel\"\n}\n```\n- Response Header: `HTTP 201`\n- Response Body:\n```\n{\n    \"status\": 201,\n    \"message\": \"Successfully Registered as subscriber to the channel\",\n    \"data\": null\n}\n```\n\n### Push Messages\n- Method: `POST`\n- Path: `/publish`\n- Request Body:\n```\n{\n    \"publisher\": {\n        \"id\": \"Uuid\",\n        \"channel\": \"channel\"\n    },\n    \"update\": \"message\"\n}\n```\n- Response Header: `HTTP 200`\n- Response Body:\n```\n{\n    \"status\": 200,\n    \"message\": \"Notified All Subscriber\",\n    \"data\": null\n}\n```\n\n\n### In order to use the SDK functions:\n* `go get` the package \n```\ngo get github.com/vatsal278/msgbroker\n```\n* `import` the `sdk` package in the source code\n```\nimport \"github.com/vatsal278/msgbroker/pkg/sdk\"\n```\n* Get an instance to the SDK Wrapper, Passing in the url to a running message broker service.\n```\ns := sdk.NewMsgBrokerSvc(\"Message broker service url\")\n```\n* Register a publisher to push messages to a `channel`. A Uuid of the publisher will be returned that needs to be used to push message to the `channel`.\n```\nuuid, _ := s.RegisterPub(\"channel\")\n```\n* Register a subscriber to receive messages on a `channel`. \nSend in the `HTTP method`, `URL` to the subscriber endpoint, optional `RSA public key` \n(this will be used by the message broker to encrypt the message before notifying the subscriber) and the `channel`\n```\n_ = s.RegisterSub(\"HTTP method\", \"URL\", \"RSA public key\", \"channel\")\n```\n* Push `message` to all the subscribers registered on the `channel` using the registered publishers `Uuid`.\n```\n_ = s.PushMsg(`message`, Uuid, \"channel\")\n```\n* Extract `message` pushed to the subscriber registered on the `channel`, additionally decrypting with `RSA private key`,\nif opted for receiving encrypted messages during subscriber registration.\n`source` is of type `io.ReadClosure` which can be requests body.\n```\nMsgExtractor := s.ExtractMsg(RSA private key)\nmsg, _ := MsgExtractor(source)\n```\n* Examples of the sdk usage can be found [here](./example)\n\n## Additional read\n* [Docs](./docs/README.md)\n* To check the code coverage \n```\ncd docs\ngo tool cover -html=coverage\n```\n  \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatsal278%2Fmsgbroker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvatsal278%2Fmsgbroker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatsal278%2Fmsgbroker/lists"}