{"id":31478466,"url":"https://github.com/mickaelpham/loan-broker","last_synced_at":"2025-10-02T03:05:50.056Z","repository":{"id":56535223,"uuid":"308460935","full_name":"mickaelpham/loan-broker","owner":"mickaelpham","description":"Loan Broker application using Message Queues","archived":false,"fork":false,"pushed_at":"2020-11-02T16:31:34.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-27T08:14:51.738Z","etag":null,"topics":["messaging","rabbitmq","ruby"],"latest_commit_sha":null,"homepage":"https://www.enterpriseintegrationpatterns.com/","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/mickaelpham.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}},"created_at":"2020-10-29T22:07:15.000Z","updated_at":"2020-11-02T16:31:36.000Z","dependencies_parsed_at":"2022-08-15T20:31:13.572Z","dependency_job_id":null,"html_url":"https://github.com/mickaelpham/loan-broker","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/mickaelpham/loan-broker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickaelpham%2Floan-broker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickaelpham%2Floan-broker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickaelpham%2Floan-broker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickaelpham%2Floan-broker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mickaelpham","download_url":"https://codeload.github.com/mickaelpham/loan-broker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickaelpham%2Floan-broker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277947281,"owners_count":25903929,"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-10-02T02:00:08.890Z","response_time":67,"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":["messaging","rabbitmq","ruby"],"created_at":"2025-10-02T03:05:48.916Z","updated_at":"2025-10-02T03:05:50.040Z","avatar_url":"https://github.com/mickaelpham.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Ruby](https://github.com/mickaelpham/loan-broker/workflows/Ruby/badge.svg)\n\n# Loan Broker\n\nImplementing a Loan Broker application using Message Queues (MQ).\n\n![implementation using queues](./asynchronous-using-mq.gif)\n\nCredits:\n[Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/ComposedMessagingMSMQ.html)\n\n## Running the app\n\nFirst, ensure you meet the prerequisites:\n\n- [Ruby Environment](http://www.ruby-lang.org/en/)\n- [Docker Desktop](https://www.docker.com/products/docker-desktop)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n\nClone the repository:\n\n```\ngit clone https://github.com/mickaelpham/loan-broker.git\ncd loan-broker\n```\n\nInstall the Ruby dependencies:\n\n    bundle install\n\nStarts the background services:\n\n    docker-compose up\n\nUse foreman to run all applications:\n\n    foreman start\n\nFinally, send a test message:\n\n    bundle exec ruby loan-test-client/generate_test_message.rb\n\n## Components\n\n### Component: Generate Test Loan Request Message\n\n- Fake customer personal info\n- Request a loan\n\n### Component: Credit ScoreContent Enricher\n\n- Consumes `loanRequestQueue`\n- Send message to `creditRequestQueue`\n- Consumes `creditReplyQueue`\n- Invoke `RecipientList`\n\n### Component: Recipient List\n\n- Receive an input (`consumer_credit_score`)\n- Returns an array of bank names to send the application to\n- Fan out the loan request to all the bank queues\n\n### Component: Bank _n_\n\n- Consume from `bankNQueue`\n- If accepted, return loan proposal by sending message to `bankReplyQueue`\n\n### Component: Aggregator\n\n- Uses Redis `lpush` and `lrange` operations (stateful component)\n- For loan application with ID `12345`\n- Wait for _n_ responses from the bank (where _n_ is either a min. quantity of\n  replies or the number of banks for the recipient list component)\n\n### Component: Translator\n\n- Filter out rejected bank application\n- Select the most advantageous (read: cheapest)\n- Send the `0..1` (because all banks might have rejected) to the\n  `loanReplyQueue`\n\n### Component: Verify\n\n\u003e Note: these scenarios are not validated against the current code\n\n**Scenario 1**\n\ninput: Customer Jane Doe\\\namount loan: \\$10k\\\ncredit score: 820\\\nexpected loan: Bank1 with 2% interest rate\n\n**Scenario 2**\n\ninput: Customer Jack Doe\\\namount loan: \\$100k\\\ncredit score: 540\\\nexpected loan: all rejected\n\n**Scenario 3**\n\ninput: Customer John Doe\\\namount loan: \\$5k\\\ncredit score: 730\\\nexpected loan: Bank3 at 2.5% (while bank2 also returned an accepted loan at 3%)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickaelpham%2Floan-broker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickaelpham%2Floan-broker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickaelpham%2Floan-broker/lists"}