I current using a RPC call to another microservice via TCP and getting the response, but I think I can do it in this way:
whithout make a RPC call, can I use a pub/sub to send to one service, publishing some channel like request_user and subscribed to a channel like object_user_response, and then the other service that is subscribed to this request_user, publish object_user_response.
Like that:
Service A <-- (sub)object_user_response <------ Redis
Service A --> (pub)request_user -------------> Redis
Service B <-- (sub)request_user <--------------- Redis
Service B --> (pub) object_user_response ------> Redis
On receive a object_user_response, the service A checks if the id of user is the same that the function have requested.
Should I use RPC or Pub/sub for that? What is the most correct way to send data to a microservice and get response from there in terms of loosely coupled architecture, is using a RPC call or using two pub/sub, on for the request and another for the response?