Kind: Interface
Source: packages/microservices/interfaces/packet.interface.ts
Part of: Microservices
PacketId defines the minimal identifier shape for a microservice packet. It provides a string id field that can be used to correlate packets, route responses, and track requests across transport boundaries.
Properties
| Property | Type |
|---|---|
id | string |
Diagram
mermaidgraph LR Client[Client or Service] --> Packet[Packet] Packet --> PacketId["PacketId<br/>id: string"] Packet --> Transport[Microservice Transport] Transport --> Handler[Message Handler]
Usage
tsimport type { PacketId } from './interfaces/packet.interface';
function createPacketId(id: string): PacketId {
return { id };
}
const packetId: PacketId = createPacketId('request-8f4c2a');
console.log(packetId.id);
// request-8f4c2a
AI Coding Instructions
- Use
PacketIdwhenever a packet requires a stable string identifier for correlation or tracking. - Generate IDs that are unique within the relevant transport or request lifecycle, such as UUIDs or trace IDs.
- Preserve the original
idwhen forwarding, retrying, or responding to a packet unless a new correlation scope is intended. - Do not add packet payload or routing fields to
PacketId; compose it with other packet interfaces or types instead.
Was this page helpful?