Try CoAkka Runtime when you use gRPC
Start with a basket pricing request. Find who relies on its API, then choose whether to keep gRPC, call the internal work through CoAkka Runtime, or use both.
Follow one pricing request
- gRPC between processes
- Checkout → gRPC client calls
Quote→ HTTP/2 → gRPC server → pricing handler - CoAkka Runtime between processes
- Checkout →
samples.order.quotetarget → CoAkka Runtime delivers to a peer → pricing handler - Keep the gRPC API, change the internal call
- Existing client →
QuotegRPC API → app callssamples.order.quotethrough CoAkka Runtime → pricing handler
In all three paths, the pricing handler still receives the basket and returns a quote. CoAkka Runtime keeps the same target name when the route points to a handler in the same process in Embedded mode or to a peer. See the Embedded path.
| Criteria | gRPC | CoAkka Runtime |
|---|---|---|
| Call contract | The Quote method and its request and reply types are usually defined in a .proto file. gRPC tooling can generate client and server code from it. |
Both sides agree on a target name and data format. The basket sample sends JSON. The application validates the data and manages format changes. |
| Destination and scaling | A client calls a service method. Service addresses, instance discovery, and load balancing depend on gRPC and infrastructure configuration. | A route identifies a local handler or eligible peers. With multiple peers, CoAkka Runtime selects an endpoint according to the configured routing policy. |
| Replies and failures | The client receives a gRPC status and response data on success. For example, DEADLINE_EXCEEDED signals that the wait expired. |
The app distinguishes business replies, admission refusals, Deadletters, and timeouts. When an admitted request has no route, its Deadletter includes the reason and the original payload. |
| Single reply and streaming | A method can return one result or stream messages from the client, the server, or both. | This example uses one request and one reply. Stream Lane has its own contract. |
| Security and operations | A service can use TLS and interceptors for authentication, authorization, and call logging under its existing API contract. | Peer connections can use TLS/mTLS. The app still authorizes business actions. CoAkka Runtime provides route and delivery information for diagnosis. |
When to keep gRPC
- Keep gRPC at service boundaries. Keep the API when partners, other teams, or independently released apps rely on generated clients, status codes, interceptors, or established authentication.
- Keep gRPC when clients depend on existing streams. A change to a streaming method must preserve how clients send, receive, cancel, and observe errors.
- Try CoAkka Runtime for work owned by one application. Start with a single-reply call such as basket pricing. If gRPC clients already exist, try changing the call behind the endpoint first.
Preserve the contract at the gRPC endpoint
The existing gRPC server still serves the endpoint. The app authorizes the caller and validates the input, then uses part of the remaining deadline for the internal call. On a route miss or timeout, the app reads the CoAkka Runtime outcome and chooses a status under its existing gRPC contract.
Try switching one internal call
- Record the current result. Use the same basket and record the quote, error statuses, and deadline of an existing gRPC call. Keep that path for comparison and rollback.
- Run the CoAkka Runtime path. The basket demo runs Node.js and Python on the same machine. The sample basket returns a total of USD 48.00. The gRPC endpoint in the diagram represents an existing API.
- Test outcomes in staging. Try a valid basket, a rejected basket, an unavailable handler, and a late reply. If you keep the gRPC endpoint, use the existing client to verify authentication, response data, and status codes.
An expired deadline means the caller did not see the result in time. For a request that can change data, check the outcome before retrying. Handle timeouts and retries.