write option lets you fan events out to a non-Boundary destination — or replace the Boundary transport entirely. write is called with the full batch every time the batcher flushes.
Signature
Mirror mode — apiKey + write
Both fire on every flush. Useful for a local mirror during rollout:
Replacement mode — write only
Omit apiKey and no HTTP traffic is sent. Every event goes only to your sink.
apiKey and without write, createBoundaryLogger returns null. With either one configured, it returns a live logger.
Integrations
Pino
OpenTelemetry logs
Write to a file (Node only)
Kafka / SQS / your existing bus
Failure handling
Ifwrite throws or rejects, the batcher routes the error through onError:
Back-pressure
write runs inline with the flush, so a slow sink slows flushes — which in turn makes the queue fill up faster. If your sink can block for long, either:
- Apply
maxQueueSizeaggressively (lower it to something you’re comfortable dropping), or - Let
writereturn quickly and buffer on its own (e.g. push to a local ring buffer that a worker drains).
See also
Batching
Flush triggers and queue overflow
Resilience
HTTP retry, circuit breaker, rate limits