Decoupling REST API processing to other microservices through MQ

I have a platform that has some requirements including the following:

  • Generating PDF/Image files from raw data in async.
  • Uploading these files to DB and/or AWS S3 Buckets
  • Complex RBAC verification processes.
  • Sending emails/SMS/Notifications to users
  • Integrating several different third-party services
  • Performing CRON Scheduled tasks like metric aggregation or cleanup processes of database.
  • Other common REST API, MQ service procedures.

We’re also having to ensure these scenario working:

  • We’ll deploy this platform in several countries, and on each country some processes vary, for example: A Payment process can allow for usage of different services on each country, as well as emitting receipts or notifying of payments in different third-party services.
  • Different costumers might use alternative ERP’s/Accounting third-party software to process payment information and we want to send payment info to each one separately.

So to achieve this functionality we thought about implementing several microservices for each task, and have them read their tasks from several queues that somehow, work differently for each country/customer. This also would allow us to migrate each indepent service to other frameworks separately, that we cannot do now due to them all being in the same service.

I thought about implementing something along the lines of this:

  1. WebUI Portal emits a requests to get payment options to a Payment REST API Service
  2. Payment REST API emits and RBAC Request to RBAC Service through a QUEUE1
  3. Payment RBAC Service verifies the operation and emits the operation request to QUEUE2
  4. Several ThirdParty-based Services subscribe to QUEUE2, each modifying what would end-up being the expected response to the original REST-API adding their own Payment option information.
  5. When all thirdparty services finish up, the message gets send to QUEUE3/Returned to Payment REST API.
  6. REST API Verifies the message and responds the HTTP Request with the payment options/info.

My questions regarding this would be:

  1. How could I use an MQ, like Kafka or RabbitMQ, to have different services subscribe to these messages on each country/server, each without knowing each other, and have them all process the message sequentially and have the message return to the final queue after all are done? If none of these consumers know if they are the last processor, how can they acknowledge the message or send it to another queue?

  2. Is having an MQ interposed between the request and response process of a REST API something acceptable or desirable? I realize having a WebSocket on the WebUI would probably be better for this async nature but having an REST API in front has several advantages that I wouldn’t like to forfeit.

I also realize that I could somehow configure each service/step of the processing chain oneach server, indicating to each of them in which order they must process the messages and which is the last one, however I’m afraid that this configuration could get really complicated over time and that not all scenarios could be solved by and ordering. This payment procedure is just one example of the many variations that we face.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật