A
A
AHMED_RAPIRA2021-12-13 22:37:06
JavaScript
AHMED_RAPIRA, 2021-12-13 22:37:06

Is it acceptable to bind two front-end microservices via a message bus to their message api?

There is a wrapper application, and it renders two services A and B, throwing a websocket instance into them. These services are autonomous, working directly with messages from the websocket in pub sub mode. If service A leaves a request to change the value in the database, then service B will know about it, for example.

But now there is a situation with ui logic: for example, when I click a button in service A, some kind of panel should appear in service B. If you turn this through a web socket, it turns out to be very expensive in terms of resources. It turns out that you need to additionally create a message bus at the wrapper application level, pass it to services A and B and come up with an additional message api for similar ui logic. But the services still get that there will be a dependency on this library with a message bus, and a link to this api. Is it all right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Robur, 2021-12-16
@AHMED_RAPIRA

But the services still get that there will be a dependency on this library with a message bus, and a link to this api. Is it all right?

Well, this is exactly how your task is formulated - "there was a need to connect two services with each other."
You will not be able to bind a service to something external if you do not add a dependency to this external one in one form or another.
In such a situation, relying on a standard api that abstracts one service from another is a good and even correct option.

W
WapSter, 2021-12-13
@wapster92

I did something similar, the websocket service was catching messages from the ORM. At change of a DB gave messages on the front. If the front is subscribed to entity changes, then during an event from sockets, it turned to the backend API to receive data conditionally. And it's quite normal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question