{"id":19673373,"url":"https://github.com/ilcande/contractor-app","last_synced_at":"2026-04-24T20:04:04.158Z","repository":{"id":224824067,"uuid":"425492378","full_name":"ilcande/contractor-app","owner":"ilcande","description":"a simple application for payment requests where a contractor create payment requests to display on a separate manager app through RabbitMQ and Bunny","archived":false,"fork":false,"pushed_at":"2021-11-07T12:05:36.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-18T09:50:11.410Z","etag":null,"topics":["bunny","rabbitmq","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ilcande.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}},"created_at":"2021-11-07T12:05:14.000Z","updated_at":"2021-11-07T12:10:44.000Z","dependencies_parsed_at":"2024-02-27T23:01:59.070Z","dependency_job_id":null,"html_url":"https://github.com/ilcande/contractor-app","commit_stats":null,"previous_names":["ilcande/contractor-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ilcande/contractor-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilcande%2Fcontractor-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilcande%2Fcontractor-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilcande%2Fcontractor-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilcande%2Fcontractor-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilcande","download_url":"https://codeload.github.com/ilcande/contractor-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilcande%2Fcontractor-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260733027,"owners_count":23054186,"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":["bunny","rabbitmq","ruby","ruby-on-rails"],"created_at":"2024-11-11T17:15:04.397Z","updated_at":"2026-04-24T20:03:59.139Z","avatar_url":"https://github.com/ilcande.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n## Requierements\nCreate two simple Rails applications. Use events, carried over a message broker (eg. RabbitMQ, Kafka, Amazon SQS, etc.) for inter-app communication. It's OK to use libraries, whether it's just a client (eg. bunny) or a full-on message processing system (hutch, karafka, etc).\n\nEach application needs to have its own, separate database.\n\n* Contractor app: a simple application for payment requests where a contractor can request a payment from their manager. A payment request consists of amount, currency, and text description. The contractor should be able to see all of their payment requests, whether they're pending, accepted, or rejected.\n\n* Manager app: a simple application that displays all payment requests submitted by the contractor. The manager can only accept or reject the payment request. The acceptance/rejection of payment request should be handled by the manager app publishing an event and the contractor app processing the event to update the status for the contractor.\n\n## Objective\nI have this solution to do this:\n\n*  Use message queue (Advanced Message Queuing Protocol)\nThis is the solution I choose. Basically AMQP allow that a producer (our Contractor) notify our consumer (Manager) that a new payment request has been created, in a real time. Once it's created it will push this data into a dedicated queue that will be received by the consumer. Efficient, timely and single responsability compliant.\n\n* In this app I configure the producer.\n\n## Configuration\n\nMain goal is to push a message in a queue when we create a new payment request. I’m going to work with `RabbitMQ` and the `Bunny` gem.\n\nFirst I have to install RabbitMQ on my machine\n```\nbrew install rabbitmq\n```\n\nthen run\n```\n/usr/local/opt/rabbitmq/sbin/rabbitmq-server\n```\n\nand go to the admin interface http://localhost:15672/ . Password and username are « guest » .\n\nAt this point, I add the bunny gem to Gemfile\n\n```\ngem 'bunny'\n```\n\nand I instantiate a Bunny instance to start a connection, then I create a channel to fanout a queue name to this very channel.\n\nAs I want to notify the Manager each time that a payment request is created I call the publish in a create callback.\n\nWith the RabbitMQ server running in one terminal (`/usr/local/opt/rabbitmq/sbin/rabbitmq-server`) open a rails console and create a payment request, browse to http://localhost:15672/ and click ont the Exchange tab. You should see an Exchange named `« display.payment_request »`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filcande%2Fcontractor-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filcande%2Fcontractor-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filcande%2Fcontractor-app/lists"}