{"id":22217281,"url":"https://github.com/saufiroja/simple-message-broker","last_synced_at":"2025-07-27T14:31:32.087Z","repository":{"id":210335305,"uuid":"726319629","full_name":"saufiroja/simple-message-broker","owner":"saufiroja","description":"simple example using message broker with golang","archived":false,"fork":false,"pushed_at":"2023-12-02T03:51:50.000Z","size":109,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-27T04:00:31.902Z","etag":null,"topics":["apache-kafka","docker-compose","go","golang","message-broker","testing"],"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/saufiroja.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}},"created_at":"2023-12-02T03:20:00.000Z","updated_at":"2023-12-04T01:17:35.000Z","dependencies_parsed_at":"2023-12-02T05:25:02.631Z","dependency_job_id":"bc42f169-dd27-4f98-b683-3b047dbd92f0","html_url":"https://github.com/saufiroja/simple-message-broker","commit_stats":null,"previous_names":["saufiroja/simple-message-broker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fsimple-message-broker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fsimple-message-broker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fsimple-message-broker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fsimple-message-broker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saufiroja","download_url":"https://codeload.github.com/saufiroja/simple-message-broker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227810263,"owners_count":17823176,"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","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":["apache-kafka","docker-compose","go","golang","message-broker","testing"],"created_at":"2024-12-02T22:15:54.578Z","updated_at":"2024-12-02T22:16:00.728Z","avatar_url":"https://github.com/saufiroja.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./image/goxkafka.png\" alt=\"Plot\"\u003e\n\u003c/div\u003e\n\n# INTRODUCTION\n\nMessage broker is a software that acts as an intermediary in delivering messages to different applications or services. In a distributed network architecture, message brokers facilitate communication between multiple systems and applications by receiving messages from the sender and forwarding them to the intended recipient, or can be referred to as pub/sub.\n\nSome popular examples of message brokers are **Apache Kafka** and **RabbitMQ.**\n\u003c/br\u003e\n\u003c/br\u003e\n\n### Why do we use a message broker?\n\nActually, the application can run smoothly. We can see a sample application schema without using a message broker.\n\n\u003cdiv align=\"center\" style=\"background-color: white; padding: 20px;\"\u003e\n  \u003cimg src=\"./image/example1.png\" alt=\"Plot\"\u003e\n\u003c/div\u003e\n\nBecause everything is done synchronously, the user will wait for the request until all the processes are completed, which there is no guarantee that the order is successful, due to the many order processes carried out by the order service. We will take an example, suppose when the order service sends an email to the notif service and it turns out that the notif service is dead or down, then all transactions made will fail. This is where the message broker plays a role, the order service will send the order data to the message broker, then the message broker will send the order data to the email service and push notification service.\n\n\u003cdiv align=\"center\" style=\"background-color: white; padding: 20px;\"\u003e\n  \u003cimg src=\"./image/example2.png\" alt=\"Plot\"\u003e\n\u003c/div\u003e\n\nCan be seen in the example above, in the message broker we will recognize the term pub / sub, where pub means publisher or who sends messages while sub means subscriber or who receives messages. usually between publishers and subscribers are divided into 2 different services. Communication between these services is no longer synchronous but can be asynchronous, one of which uses a message broker.\n\u003c/br\u003e\n\u003c/br\u003e\nSo the order service will only receive requests, manage data, and send order data that will be consumed by the notification service. This way, the user doesn't have to wait for the response until all processes are complete, which means the chance of success will be greater. If the notification service is down, the order service will still send the order data to the message broker, and the message broker will send the order data to the notification service when the notification service is up again.\n\u003c/br\u003e\n\u003c/br\u003e\nBut there is a challenge, namely when the service will be interdependent with the message broker. For example, when this message broker is down or dead, it will ensure that communication between services will be hampered. However, to overcome this, it is important to choose a stable or good message broker, one of which is Apache Kafka and RabbitMQ.\n\nIn this repository, will implement simple message broker using Apache Kafka and Golang.\n\n# REQUIREMENTS\n\n- Go 1.2x or higher\n- Apache Kafka\n- Docker\n- Docker Compose\n\n# USAGE\n\n- Clone this repository\n\n```bash\ngit clone https://github.com/saufiroja/simple-message-broker.git\n```\n\n- Run docker compose\n\n```bash\ndocker-compose up -d\n```\n\n- Run consumer\n\n```bash\nmake order\n```\n\n- Run producer\n\n```bash\nmake notif\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaufiroja%2Fsimple-message-broker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaufiroja%2Fsimple-message-broker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaufiroja%2Fsimple-message-broker/lists"}