Skip to content

Hosts & transports

A host is what adapts the engine to a runtime model. Hosts never duplicate composition logic; they wire the engine into the runtime they know about (HTTP server, generic host, …) and map transports into the behavior pipeline.

PackageMaturityPurpose
Cephalon.AspNetCoreM3ASP.NET Core host. Built-in REST, SSE, WebSocket transport mapping. OpenAPI + Scalar surface.
Cephalon.AspNetCore.GraphQLM2GraphQL transport adapter for AspNetCore. Federation-friendly, module-owned subschemas.
Cephalon.AspNetCore.GrpcM2gRPC transport adapter — unary and streaming. Module-owned proto types.
Cephalon.AspNetCore.JsonRpcM2JSON-RPC transport adapter. Useful for IDE / tooling protocols.
Cephalon.WorkerM3Generic-host worker adapter for non-HTTP runtime scenarios.

Cephalon ships first-party transport adapters for:

  • REST — built into Cephalon.AspNetCore. Behaviors map to typed routes. OpenAPI / Scalar generated.
  • JSON-RPCCephalon.AspNetCore.JsonRpc. Behaviors map to typed methods.
  • gRPCCephalon.AspNetCore.Grpc. Unary + streaming. Code-first or proto-first.
  • GraphQLCephalon.AspNetCore.GraphQL. Federated subschemas per module.
  • SSE / WebSocket — built into Cephalon.AspNetCore for streaming.

Multiple transports can be enabled in one host. Modules use behavior bases (RestBehaviorModuleBase, JsonRpcBehaviorModuleBase, GrpcBehaviorModuleBase, GraphQlBehaviorModuleBase) to expose surface declaratively.

If your app is…Pick
HTTP-fronted (the default)Cephalon.AspNetCore
Worker / background / queue-drivenCephalon.Worker
Both (HTTP + worker), same processCephalon.AspNetCore (it can host workers via IHostedService)
Both, different processesOne host per process. Share modules through assembly references or package manifests.

The REST adapter turns module behaviors into ASP.NET Core endpoints:

Behaviors/CreateOrderBehavior.cs
public sealed class CreateOrderBehavior : IRestBehavior
{
public RestRoute Route => RestRoute.Post("/orders")
.WithSummary("Place an order")
.WithTags("Commerce")
.Produces<Order>(201);
public Task<IResult> Handle(CreateOrderPayload p, IOrderRepository orders, CancellationToken ct) =>
/* ... */
}

The behavior pipeline applies cross-cutting decorators (audit, metrics, auth) deterministically. The OpenAPI document and Scalar UI pick up the behavior automatically. Behaviors can opt into WithApiVersion(...), WithRateLimit(...), WithRequireScope(...), and other engine-blessed extensions.