Skip to content

blackbull.server.http1_actor

blackbull.server.http1_actor

HTTP/1.1 Actor classes for the BlackBull actor model.

HTTP1Actor drives the keep-alive loop for one TCP connection. RequestActor owns the lifetime of a single HTTP request.

HTTP1Actor

Bases: Actor

Drives the HTTP/1.1 keep-alive loop for one connection.

Supervisor strategy: isolate — an unhandled exception from a RequestActor closes the connection without crashing sibling connections.

If aggregator is None the actor fires events through app._dispatcher directly, so an app assembled without an EventAggregator still receives the lifecycle events.

run() async

Keep-alive loop — process requests until connection closes.

RequestActor

Bases: Actor

Owns one request's app boundary: what the app is called with.

Shared by both protocol actors — H/1 reuses one instance per connection via bind; H/2 builds one per stream. Owns the app-facing representation (the native Connection on the default lane, the materialized ASGI scope on BB_FORCE_ASGI_SCOPE=1), binds the raw recipient before any wrapper exists, and calls the app.

The request-lifecycle Level B events are emitted by the application layer (BlackBull._dispatch / __call__) — the cross-transport emission points — not here. The actor layer emits only the Level B error event, for exceptions that escape the app call (e.g. a raising global middleware).

bind(conn, recipient, send)

Bind the next sequential HTTP/1.1 request; retain per-connection settings.

Do not share this actor across concurrent HTTP/2 streams.