{"id":18986761,"url":"https://github.com/saumya40-codes/pubsub","last_synced_at":"2026-04-17T08:31:16.865Z","repository":{"id":242824001,"uuid":"810207309","full_name":"Saumya40-codes/pubsub","owner":"Saumya40-codes","description":"A very basic pubsub implementation written in GO","archived":false,"fork":false,"pushed_at":"2024-06-05T07:04:27.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T07:07:15.115Z","etag":null,"topics":["golang","pubsub"],"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/Saumya40-codes.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":"2024-06-04T08:54:16.000Z","updated_at":"2025-02-26T05:14:19.000Z","dependencies_parsed_at":"2024-06-05T07:58:50.839Z","dependency_job_id":null,"html_url":"https://github.com/Saumya40-codes/pubsub","commit_stats":null,"previous_names":["saumya40-codes/pubsub"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Saumya40-codes/pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saumya40-codes%2Fpubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saumya40-codes%2Fpubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saumya40-codes%2Fpubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saumya40-codes%2Fpubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Saumya40-codes","download_url":"https://codeload.github.com/Saumya40-codes/pubsub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saumya40-codes%2Fpubsub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31921758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":["golang","pubsub"],"created_at":"2024-11-08T16:36:34.068Z","updated_at":"2026-04-17T08:31:16.849Z","avatar_url":"https://github.com/Saumya40-codes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PUBSUB\npubsub is a communication/streaming service where exchange of messages happens without producer knowing who sender might be\n\nThe project tries to implement a kafka-like pubsub based model/arch functionality\n\nSome of the main components involved:\n\n- Broker: A single instance or a node which is responsible for accepting the incoming messages, storing them and directing them to specific client/consumers.\n- Topics: Different categories in which messages might be organized, and can have more then one partition within it.\n- Producers: Produces a message to a particular topic and to a particular partition.\n- Consumers: Consumer subscribe to a particular topic, during this a partitions might be assigned to it to which it will be listening to incase on any message received there.\n    - The partition in this are *auto-balancing* that is all consumer takes the equal amount of load of listening to the partitions\n\n![arch](https://github.com/Saumya40-codes/pubsub/assets/115284013/f71c763e-0bbd-4ef3-90a4-557404573de9)\n\n### Some main functions\n\n**Installation**\nOn terminal using go\n```\ngo get github.com/Saumya40-codes/pubsub\n```\n\nimport *core_pubsub \"github.com/Saumya40-codes/pubsub/core\"*   [if it doesn't get automatically while going through below procedure]\n\n*Some functions*:\n\nCreate a broker instance\n\n```\nbroker := core_pubsub.GetorSetBrokerInstance()\n```\n\nCreate new topic\n\n```\nnewTopic, err := broker.CreateNewTopic(topicName, No_of_partitions)\n```\n\nCreate a new consumer\n```\nconsumer := core_pubsub.CreateConsumer(name, groupId)\n```\n\nSubscribe to a topic\n\n```\nerr := consumer.Subscribe(consumer, topicName)\n```\n\nListen for any change in subscribed topic\n\n```\nconsumer.Run()\n```\n\nCreate producer\n\n```\nproducer := core_pubsub.CreateProducer(producerName)\n```\n\nCreate a message to be sent\n\n```\nmessage := core_pubsub.CreateMessage(topicName, messageContent, partitionIndex)\n```\n\nPublish the message\n\n```\nerr := producer.Publish(topicName, message)\n```\n\nYou can refer more: [here](https://github.com/Saumya40-codes/pubsub/blob/master/main.go)\n\n## Use case/example\n\nConsider following simple stock prediction architecture\n\n![image](https://github.com/Saumya40-codes/pubsub/assets/115284013/10a70e6e-10f3-43fd-a85d-adab557d40ae)\n\nNow only those consumer will receive message who are subscribed to particular partition in a topic to which consumer is sending message to. \nOn new consumer, auto load-balancing occurs (if existing consumer has more then one partiton)\n\n**Output/Execution**:\nCreating topics, consumer and subscribing them to relavant topics \n\n![image](https://github.com/Saumya40-codes/pubsub/assets/115284013/a44fcdf9-3652-4770-a35d-b00e2d45f8d6)\n\nPublishing of messages by producer and consumer receiving it (here order might be deferring as processes are running concurrently)\n\n![image](https://github.com/Saumya40-codes/pubsub/assets/115284013/891a7291-849e-4010-b958-9c92b2545e00)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaumya40-codes%2Fpubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaumya40-codes%2Fpubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaumya40-codes%2Fpubsub/lists"}