property NatsMessagingOptions.headersFactory

Factory building the NATS MsgHdrs used to carry transport headers.

Required alongside client for trace propagation: an injected connection carries no nats module, so the broker has no headers() to call. A lazily-loaded connection supplies its own and needs nothing here.

Examples

Example 1

import * as nats from 'npm:nats@2.x';
MessagingPlugin({ broker: 'nats', client, headersFactory: () => nats.headers() });

Type

Usage

import { type NatsMessagingOptions } from "messaging-plugin/src/index.ts";