Product knowledge · Beginner · One process

How does a request move through CoAkka HTTP Runtime?

Follow GET /customers/42 from route declaration to the client response. Learn what the application writes, which request values are available and where each failure is handled.

01 · One request in one process

Five steps to remember

1

The client sends a request

For example, GET /customers/42?include=balance with an authorization header.

2

CoAkka HTTP Runtime selects a route

GET /customers/{id} matches and the handler receives the request values.

3

The handler runs business logic

The application validates id, checks permission and loads the customer.

4

The handler creates a response

For example, 200 with JSON, 404 when absent or 403 when forbidden.

5

The client receives the result

The runtime sends the response and the application remains ready for the next request.

Learn more · Responsibility boundaries

CoAkka HTTP Runtime

Accepts connections, reads HTTP, selects routes, applies limits and sends responses.

Language connector

Presents requests and responses as natural Go, JVM, Python, JavaScript or C/C++ values.

Application

Owns user authentication, business validation, database access and response content.

02 · Declare and start

Declare routes first, then start the service

declare address + routes + handlers
              ↓ start
success → running service + actual address
failure → fix configuration and start again
Before start
Add the routes, handlers and limits the application needs.
During start
An invalid route, unavailable port or bad configuration returns an error; no service is ready.
After start
Keep the service for the application lifetime and use the actual address returned by the API.

For local learning, use loopback and port 0 so the operating system selects an available port. Each language example prints the actual address so it can be called immediately.

03 · Method and path

A route selects the matching handler

Method + path

GET /customers/{id} and POST /customers are different routes.

Path parameter

For /customers/42, the handler receives id = 42; decode and validate it before use.

Query

?include=balance adds an option. Distinguish absent, empty and repeated values.

Header

Use headers for metadata such as authorization, content type and request ID, not large business payloads.

An inbound route differs from an outbound path. The server declares /customers/{id}; a client calls a concrete path such as /customers/42?include=balance.

04 · Request data

Begin with an ordinary request

The handler receives method, path parameters, query, headers and body through the natural API of the chosen language. A create-customer handler can read JSON, validate required fields and convert it to an application model.

Path

id = 42; validate its format and access permission.

Query

include = balance; accept only documented options.

Header

Read authorization, content type or request ID when the endpoint needs them.

Body

Read text, JSON or small binary content within configured limits.

Large files or incrementally arriving data belong in the advanced Streaming lesson.

05 · Business handler

The handler is where business logic lives

Example: find the customer by id; return 200 when found and 404 otherwise. Keep internal diagnostics in safe logs instead of returning them directly to the client.

06 · Response

Choose status, headers and body

Status
Follow the API contract: 200, 201, 400, 404 or another suitable status.
Headers
Set content type, cache policy or other public metadata the client needs.
Body
Return text, JSON, small binary content or an empty response through connector helpers.
Once
Complete each request once; never send a second response after timeout or cancellation.

Do not hand-write Content-Length or Transfer-Encoding; use the CoAkka HTTP Runtime response API.

07 · Failure by stage

Ask “did it reach the handler?” before retrying

StageExampleOwner action
StartupInvalid route or port already in useFix configuration; the service has not accepted requests.
Before handlerMalformed request or configured limit exceededFix the client or limit; business logic did not run.
In handlerForbidden, validation or database failureReturn a suitable status and keep diagnostics safe.
While respondingResponse too large or already completedFix the handler; do not submit a second response.
Timeout/disconnectThe client no longer waits for a resultDo not retry blindly; business work may have run.
During shutdownDeadline expires while work remainsKeep the service and dependencies alive, then follow operational policy.

Do not turn every failure into HTTP 500. Validation, forbidden, not found, overload and timeout require different actions. Use the error kind supplied by the API; never parse error text.

08 · Stop the service

Stop new requests, then wait for active work

remove the instance from the load balancer when present
  → call close with a finite deadline
  → wait for active requests
  → release dependencies only after close succeeds

09 · Beginner review

Before choosing a language