github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/docs/ideas/composites.md (about) 1 # Composites 2 3 Composites are a way of chaining requests across multiple services 4 5 ## Overview 6 7 The normal flow of programming in a microservices world starts by creating independent services which encapsulate domain boundaries. 8 Overtime these boundaries bleed and direct synchronous requests are made to retrieve information across them. In a system thats 9 well governed this is done as a set of orchestration services that encapsulate a higher level domain boundary. Often orchestration 10 services are handwritten as a new service where it may make sense for this actually just to be a lightweight Composite that 11 describes the relationship, flow and transformations. 12 13 ## Design 14 15 A Composite is much like unix pipelining. There's no understanding of the data, there's no specific hard coded values or programs. 16 Service calls are initiated with the responses sequentially piping one into the next. This is not GraphQL which spans independent 17 services and morphs the data but actually taking the request from one service and pushing it through another until we have the 18 expected result. This is a form of mapreduce. 19 20 ## Implementation 21 22 Composites work at the API level by taking the `~` operator as a aggregator function for various service calls. 23 24 A simple example like so 25 26 ``` 27 curl http://localhost:8080/ping~pong 28 ``` 29 30 This will make a request to the ping service endpoint Ping.Call and then push the response into pong service Pong.Call.