{"id":15064645,"url":"https://github.com/tamhub/messaging-adapter","last_synced_at":"2025-11-11T18:39:58.698Z","repository":{"id":56883350,"uuid":"152429039","full_name":"tamhub/messaging-adapter","owner":"tamhub","description":"Messaging adapter gem for Ruby, useful for using message brokers (RabbitMQ, Kafka,...) in Ruby applications","archived":false,"fork":false,"pushed_at":"2018-10-18T06:35:33.000Z","size":34,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2025-10-07T23:13:39.046Z","etag":null,"topics":["adapter","adapter-pattern","event-bus","kafka","message-broker","message-bus","message-queue","messaging","rabbitmq","ruby","ruby-gem","ruby-on-rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tamhub.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}},"created_at":"2018-10-10T13:34:32.000Z","updated_at":"2020-12-17T12:46:38.000Z","dependencies_parsed_at":"2022-08-21T00:20:16.614Z","dependency_job_id":null,"html_url":"https://github.com/tamhub/messaging-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tamhub/messaging-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamhub%2Fmessaging-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamhub%2Fmessaging-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamhub%2Fmessaging-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamhub%2Fmessaging-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tamhub","download_url":"https://codeload.github.com/tamhub/messaging-adapter/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamhub%2Fmessaging-adapter/sbom","scorecard":{"id":867256,"data":{"date":"2025-08-11","repo":{"name":"github.com/tamhub/messaging-adapter","commit":"695e622e6d31315d18298e36615ea84c9b5793b6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-jphg-qwrw-7w9g"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T02:58:47.902Z","repository_id":56883350,"created_at":"2025-08-24T02:58:47.902Z","updated_at":"2025-08-24T02:58:47.902Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283910127,"owners_count":26915128,"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-11-11T02:00:06.610Z","response_time":65,"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":["adapter","adapter-pattern","event-bus","kafka","message-broker","message-bus","message-queue","messaging","rabbitmq","ruby","ruby-gem","ruby-on-rails"],"created_at":"2024-09-25T00:23:23.975Z","updated_at":"2025-11-11T18:39:58.667Z","avatar_url":"https://github.com/tamhub.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Messaging Adapter\nMessaging adapter gem for Ruby, useful for using message brokers (RabbitMQ, Kafka,...) in any Ruby application (including Rails applications).\n\n## Assumptions\nTo use this gem and apply the instructions in the example below you must have the following things done:\n1. Install Ruby (version 2.4.2 or higher)\n\n2. Install [RabbitMQ](https://www.rabbitmq.com/) by following the [instructions](https://www.rabbitmq.com/download.html) in the official site or if you know how to use [Docker](https://www.docker.com/) you can make and run your own RabbitMQ container from this [docker image](https://hub.docker.com/_/rabbitmq/).\n\n3. Browse to the administartion portal of RabbitMQ which will be by default on `http://localhost:15672/`.\n\n4. Create a new `exchange` to be your message router and name it `test` then create a new queue `test_queue` to be consumed then go to the exchange and bind it to the new queue so when someone publish a message to the exchange it will be directly routed to the binded queue(s) as one-to-many topology.\n\n* If you are confused a little bit then you should read about `message brokers` and especially `RabbitMQ` which is used in the below example.\n\n* Please note that points #3 and #4 are optional and written just to make the example mentioned below work.\n\n## Usage\n1. In your Ruby application install the gem from the `.gem` file using the terminal.\n    ```bash\n    $ gem install messaging-adapter-x.y.z.gem\n    ```\n    * Also the gem is available on RubyGems.org so you can install it directly:\n        ```bash\n        $ gem install messaging-adapter\n        ```\n\n2. In the application entrypoint create the broker instance with your desired adapter.\n    ```ruby\n    broker = broker = MessagingAdapter::MessageBroker.new(:RabbitMQ)\n    ```\n    * Only RabbitMQ currently implemented, Kafka has an initialized empty adapter.\n\n3. Use that instance in your application to publish a message `Hey there!!` to the exchange `test`.\n    `broker.publish('test', 'Hey there!!')`\n\n4. Use that instance in your application to subscribe to a topic/queue `test_queue`.\n    ```ruby\n    broker.subscribe('test_queue') do |payload|\n        puts \"[x] Received message: #{payload}\"\n    end\n    ```\n\nFor more details please check the `test.rb` in the root of this repository.\n\n## Usage in Rails application\n1. Add the gem to the `Gemfile` like this:\n    ```ruby\n    gem 'messaging-adapter'\n    ```\n\n2. Run `bundle install` command in the terminal.\n\n3. Go to the `config/application.rb` file in your application.\n\n4. Add the following line before the `Bundler.require` call:\n    ```ruby\n    require \"messaging_adapter\"\n    ```\n\n5. Add the following code in the last of the `Application` class:\n    ```ruby\n    class \u003c\u003c self\n      attr_reader :msg_broker\n    end\n    \n    config.after_initialize do\n      @msg_broker = MessagingAdapter::MessageBroker.new(:RabbitMQ)\n    end\n    ```\n    Here we declared a class variable `msg_broker` with reader accessor to be our single instance of the `MessageBroker` in the application, this will insure that the connection with the message broker (RabbitMQ for example) will be managed correctly.\n\n6. In your controller for example if you want to publish a message you can do it by writing in your action:\n    ```ruby\n    RailsApp01::Application.msg_broker.publish('test', 'Hey there!!')\n    ```\n    Our example application named `rails-app01` so we accessed the `msg_broker` on the `Application` class in the application module `RailsApp01`.\n\n\n## Options\nThere are some options can be passed as a hash when using `publish` and `subscribe` methods:\n1. `publish` options:\n    * `direct_to_q`: boolean value (for RabbitMQ adapter), `false` by default, if `true` then the message will be published to the queue directly, not to an exchange;\n\n        `b.publish('registration', 'my message')`: this will publish a message to an exchange (router) named `registration`.\n\n        `b.publish('registration', 'my message', direct_to_q: true)`: this will publish a message directlyto a queue named `registration`.\n\n2. `subscribe` options:\n    * `block`: boolean value (for RabbitMQ adapter), `true` by default, if `true` the subscriber will block the caller thread while working, otherwise no thread blocking.\n\n\n## Configurations\nThe follwoing are the environment variables which can be used in `.env` files to connect to the message broker (RabbitMQ or Kafka) with their default values if not provided:\n* MessageBroker_Host=\"localhost\"\n* MessageBroker_Port=\"5672\"\n* MessageBroker_User=\"guest\"\n* MessageBroker_Pass=\"guest\"\n\nPlease check the `.env.example` file for more details.\n\n* This documentation will be improved more and more in the future.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamhub%2Fmessaging-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamhub%2Fmessaging-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamhub%2Fmessaging-adapter/lists"}