Book 4 · Lesson 4.3

Axum ingestion API

  • Read ingestion Router and AppState
  • Trace github_webhook handler
  • Separate API edge from async workers

Prerequisites: 4.2 · 1.5

services/ingestion/src/main.rs is the HTTP edge — fast accept, async handoff.

Handler outline

async fn github_webhook(State(state), Json(payload)) -> Json<WebhookResponse> {
    let event_id = uuid::Uuid::new_v4().to_string();
    // build message → kafka send → return accepted
}
  • HTTP /webhooks/* — validate JSON
  • Assign event_id UUID
  • Publish to Kafka — no LLM here
  • Return 200 accepted quickly

Teach-back prompt

What stays out of the webhook handler in a production pipeline?

Read ingestion main.rs

Lesson 4.3 check

1. LLM enrichment belongs in…