EdgeStream
Incoming Hook
Incoming hooks are registered on the server's incomingPipeline. They process every message that arrives from the transport — from raw decryption all the way through to post-delivery audit logging.
Incoming Pipeline Flow
All hooks added to server.incomingPipeline are "incoming hooks." They handle the full lifecycle of a received message:
5
HookActivityLogger (priority 5)
Captures hook timings — must run first to observe all others.
90
DecryptHook (priority 90)
Decrypts encrypted body. Runs before any body inspection.
95
VerifySignatureHook (priority 95)
Verifies message authenticity on original format.
100
ValidationHook (priority 100)
Schema validation before normalization.
110
NormalizationHook (priority 110)
Converts to CloudEvents format.
120+
Custom hooks (priority 120+)
Enrichment, filtering, processing, audit. Register any hook at any priority in this range.
Registering Incoming Hooks
const server = edgeStream.server('bas')!;
// All these are "incoming hooks" — they process inbound messages
server.incomingPipeline.addHook(new HookActivityLogger());
server.incomingPipeline.addHook(new NormalizationHook());
server.incomingPipeline.addHook(new TenantFilterHook(tenantId));
server.incomingPipeline.addHook(new WorkflowEventMapperHook());
server.incomingPipeline.addHook(new AuditLogHook(auditService));
Incoming vs. Outgoing
| Aspect | Incoming Pipeline | Outgoing Pipeline |
|---|---|---|
| Triggered by | Message arrives from transport | server.send(topic, body) |
| Direction | Transport → Subscriber callbacks | Application → Transport |
| Common hooks | Decrypt, Verify, Normalize, Enrich, Audit | Sign, Encrypt, Rate-limit, Log |
| Terminal action | Publish to subscribers | Transport.send() |