Skip to content
GuidesDocs 1.3.x

Interceptors

Interceptors wrap RPC execution with cross-cutting behavior while handlers stay focused on business logic. Their order is observable: a request moves from the first interceptor toward the handler and the response unwinds in reverse.

Start with the default chain

typescript
import { createDefaultInterceptors } from '@connectum/interceptors';

const interceptors = createDefaultInterceptors({
  timeout: { duration: 10_000 },
  retry: { maxRetries: 2 },
});

Error handling and validation are structural defaults. Timeout, bulkhead, circuit breaker, retry, fallback, and serializer behavior is opt-in because it changes request semantics. The canonical chain order, defaults, and standalone factories live in Built-in interceptors; exact fields live in DefaultInterceptorOptions.

Choose the extension route

NeedRoute
Configure the supported chainBuilt-in interceptors
Add business-specific middlewareCustom interceptors
Apply behavior to selected services or methodsMethod filtering
Authenticate or authorize callsAuth and authz
Trace incoming or outgoing callsTracing
Look up an exact factory or option@connectum/interceptors API

Use native router scoping when an interceptor belongs to one service, a method-filter interceptor for declarative name patterns, and a custom interceptor only when selection depends on runtime request data.

Module route

The @connectum/interceptors module hub owns installation, the minimal example, key entry points, and Learn / Configure / API navigation.