centiservice / mats3

Mats3: Message-based Asynchronous Transactional Staged Stateless Services
https://mats3.io/
Other
63 stars 7 forks source link

Direct Invocation for Private Endpoints to Improve Efficiency: requestDirect(), similar to nextDirect() #92

Open stolsvik opened 4 weeks ago

stolsvik commented 4 weeks ago

(ChatGPT to the rescue of condensing an internal chat, with some modifications and corrections)

Summary The current setup for "private endpoints" introduces messaging overhead even when calls remain within the same service. This implementation conflicts with the intent of private endpoints, which is to create reusable client-like abstractions (e.g. a CustomerRestClient-alike alternative for Mats services). Requiring actual request-reply messages for these internal calls add quite a bit of overhead, and thus discourage such abstractions, which can in several instances go against DRY.

Problem Statement The messaging overhead for private endpoints leads to code duplication due to inefficient invocation of private endpoints. The system currently forces a message request/reply model even when the private endpoint is within the same service.

Proposed Solution Introduce a requestDirect() analogous to nextDirect():

Additionally, consider extending this concept to goto() with a gotoDirect() option for situations where the steps stay within the same service (which often is the case), further optimizing performance and reducing messaging overhead.