Adapters are the bridge between NTL and the outside world. This guide walks through building a custom adapter that exposes NTL signal handlers via HTTP — useful for connecting web applications, mobile apps, and existing services.
The Adapter Trait
Every adapter implements the core Adapter trait:
Example: HTTP Adapter
Let’s build a minimal HTTP adapter using axum:
Running the Adapter
Now any HTTP client can interact with the NTL network:
Adapter Patterns
Stateless Translation
The simplest pattern — translate external format to signal and back. No state held in the adapter.
Correlation Bridge
Hold external connections open while waiting for NTL correlated responses. Essential for request-response protocols like HTTP.
Event Stream
For protocols that support streaming (WebSocket, SSE, gRPC streams), the adapter subscribes to signal types and pushes them to the external client as they arrive.
Batch Ingestion
For high-throughput sources, the adapter accumulates external payloads and emits them as weighted signal batches at intervals.
Registering Adapters
Adapters register with the node so they appear in health checks and topology:
Testing Adapters
NTL provides a test harness for adapter development:
Last modified on September 11, 2026