79370297

Date: 2025-01-20 04:46:58
Score: 1.5
Natty:
Report link

Let me take an attempt. Would love some feedback on this answer from the wider community as well :)

(1) Is there a way for the Reservations Service to query the User Service to check the user exists (eg REST endpoint)?

It might be an additional step to verify an event from a trusted source. You have an explicit concern around data inconsistency due to race condition, which is reasonable, and necessary to address. So a sync call is OK, especially if it is to a highly available, "fast" endpoint. As your systems/teams scale, it becomes harder for core services like reservations service in this case to trust all incoming requests.

(2) No it is not bad practice. This is a data retrieval mechanism done by HTTP calls. Events are needed to fire updates/do tasks asynchronously to enable additional throughput

RE: coupling

I don't think a synchronous call results in tight coupling. It surely creates dependency and reduces resilience (e.g. one service being down). But synchronous calls are reasonable architectural design :)

Reasons:
  • Blacklisted phrase (1): Is there a way
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Tejas Parnerkar