Search code examples
asp.net-web-apidesign-patternsarchitecturemicroservicesesb

Extra layer for communication from client to Service via client ->Api->ESB->Service


We are architecting a new system where ESB is the centerline channel for service communication. as we don't want our HTML/js client to interact with a bus directly, so we decided to introduce Api (ReST-API) layer where the client will post request to Api than API will put a message in ESB and respective service will subscribe for that particular message and will process it.

so it will be like UI -> Rest -> ESB -> Service

As I knew no other services will not be interested in this particular message. so just wondering cant we do below??

UI->Rest-> Service and keep ESB used for only inter-service communications not from UI to service path. considering there will be 1000's of UI to service communication.


Solution

  • It all depends on how many subscribers(services) would need this message that is coming from UI. As of now you have identified just one service that needs this data. Introducing an ESB layer would decouple the "Rest" and "Service" layers and in the future if there are more services needing this message, a little change in ESB layer would be sufficient to meet your future needs without disturbing the "Rest" and "Service". Without ESB, you end-up in a tightly coupled pattern. Also, if the service is enhanced in the future, ESB could play a role in data transformation.