1

I am breaking a monstrously large monolithic enterprise application into several microservices and have identified business capabilities around which the services will be modeled. The application has different modules (HRMS, Transaction Management, etc.) interacting with each other. I do not have the requirement of catering to disparate devices.

There are certain request-(immediate)response use cases for which communication between microservices via an API Gateway seems apt. However, for many features, a response is not (immediately) required and publishing an event (e.g., 'EmployeeCreated') to a message broker (RabbitMQ) seems more appropriate.

My aim is to use asynchronous pub-sub as much as possible, and keep the API Gateway simple and dumb to avoid having another monolithic and single point of failure.

I have the following question(s):

i) Is it a good approach to have some features implemented by inter-microservice communication through a RESTful API-Gateway, and others via asynchronous pub-sub? Are there any challenges to be mindful of?

ii) Would it be a good option to have a central routing gateway subscribing to message broker events and calling corresponding RESTful APIs? I fear the two giants (central msg broker & API gateway) may defeat the purpose of MSA in the first place.

iii) If I am to use (i), this answer suggests windows services work better with RabbitMQ, and that self-hosted Web APIs in windows services may be a good option. This way, the windows service can consume certain events and expose some APIs for synchronous calling. Is this recommended? Assuming .Net paradigm, do asynchronous microservices necessarily need to be windows services?

Sorry for being broad in scope. Any help is appreciated.

Abubakar Mehmood
  • 938
  • 1
  • 10
  • 19
  • Pub-sub is not the only asynchronous mode to communicate. There is also polling – Constantin Galbenu Jan 17 '18 at 06:21
  • @ConstantinGalbenu. Thanks for your reply. Yes but the nature of the application is such that one action prompts several other actions and thus it makes more sense to subscribe to that 'event' and act accordingly. – Abubakar Mehmood Jan 18 '18 at 07:59
  • Your question is too vague/broad to have an complete answer. There is no single best architecture. Try to use what is best fit for each particular use case. You can have at the same time an API gateway, the microservices could talk to each other directly, you can use polling and pub-sub at the same time. Try to not have a single point of failure and to respect Single responsibility principle. Also, maybe this helps you: https://stackoverflow.com/a/47920156/2575224 – Constantin Galbenu Jan 18 '18 at 08:11

0 Answers0