Decouple a layer from multi layer architecture as a Micro Service

165 Views Asked by At

Scenario:

Currently, we have multi-tier architecture in this pattern

DBLayer => Tasks to DB
SouthBound => Talks to other devices like router/controller
SrvcLayer => Talks to both SouthBound and DBLayer
UILayer => Talks to UI and SrvcLayer

The application is built on Spring 4.2, Java 8, MongoDB.

Requirement:

We need to decouple SouthBound as a separate App or can say Micro Service.

Issue:

We are thinking of 2 ways

  1. Exposing services in SouthBound as REST API and use them in SrvcLayer. It will add some latency issue and need to figure out the security part as well.

  2. Use Message queue like RabbitMQ. But these calls have to be synchronous. So I am not sure RabbitMQ will help us.

Which approach will be suitable. Any other suggestion on how to build this usecase.

1

There are 1 best solutions below

4
On

In our application we have REST API to communicate UI <-> Backend parts of which are in its own turn connected via AMQP.

Btw RabbitMQ seems to have async supoport RabbitMQ asynchronous support so this may be enough.

Sync work of RabbitMQ is still possible (Is it appropriate to use message queues for synchronous rpc calls via ajax, https://www.rabbitmq.com/tutorials/tutorial-six-java.html) but anyway if you're using AMQP synchronously this will end with having latency so I'd say better use REST