A sample demonstrating service to service call patterns in a variety of scenarios:
- Kubernetes
- Istio (via Anthos service mesh) with services residing in a single cluster
- Istio (via Anthos service mesh) with services residing in different clusters
- Cloud Run
The "Producer" changes behavior based on the payload sent to it:
- A configurable delay can be added to the response
- A different response code can be added (say 5XX to simulate a server error)
Start a service application using the following command:
./gradlew -p sample-producer bootRun
Start a client to the service:
./gradlew -p sample-caller bootRun
A call to the Producer application:
curl -v -X "POST" "http://localhost:8080/producer/messages" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d $'{
"id": "1",
"payload": "test",
"delay": "1000",
"responseCode": 200
}'
A call to the Caller, which in-turn dispatches to the Producer:
curl -X "POST" "http://localhost:8081/caller/messages" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d $'{
"id": "1",
"payload": "test",
"delay": "1000",
"responseCode": 200
}'
A UI is available at http://localhost:8081 to test out the flow locally