These are the parties involved:
- payments: The payments core. Is a DDD payments core which allow payment request/reject/approval.
- contractor_web_ui: a web UI for contractors. It publishes the payment_requested event to the msg broker, handles the payment_accepted and payment_rejected events coming from the msg broker.
- manager_web_ui: a web UI for managers. It publishes the payment_accepted and payment_rejected events to the msg broker, and handles the payment_requested event coming from the msg broker.
- relational DB's for each web UI: contractor and manager for storing the local copy of the payment request aggregates.
- message broker Kafka for serving as message bus between the 2 web_uis
- There are 2 processes for each app. Karafka & rails web UI
- In addition to those there are the docker managed containers runing the zookeeper & kafka & postgresql processes & redis.
Role of each process:
- Kafka serves as a message bus for exchanging events between the consumer and manger app.
- Redis serves the Turbo Websocket for Rails 7 for the Realtime UI update.
- Postgresql acts as a Relational Database for both Contractor and Manager apps.
docker compose upcd contractor_web_ui && bundle install && bundle exec rails db:setup && foreman start- open a new terminal app
cd manager_web_ui && bundle install && bundle exec rails db:setup && foreman start
- Step.0.1: open
http://localhost:3000. Let's call this:Tab1. This incorporates theContractor Web UI. - Step.0.2: open a new browser tab and open
http://localhost:4000. Let's call this:Tab2. This incorporates theManager Web UI. - Step.1: In
Tab1: clickrequest new payment. Then fill the form andrequest a new payment - Step.2: The
payment requestadded in theTab1should appear inTab2. Now reject/approve as You wish inTab2 - Step.3: Go backIn
Tab1. Thepayment requestshould have the same state as it was modified in theTab2by the manager.
-
Controller classes:
- manager_web_ui/app/controllers/payment_requests_controller.rb
- contractor_web_ui/app/controllers/payment_requests_controller.rb
-
Event Handling Code:
- manager_web_ui/app/consumers/payments_consumer.rb
- contractor_web_ui/app/consumers/payments_consumer.rb

