Tracking Payload Builder

Build TrackingPayload objects explicitly for delegate and custom transport integrations.

What It Builds

TrackingPayloadBuilder creates TrackingPayload with headers, body, content type, MessagePayloadType, JsonSettings, and JsonConvertSettings.

Body Input Modes

Use SetBody(string) for text payloads or SetBody(ReadOnlyMemory<byte>) for binary payloads such as protobuf or compressed formats.

Where To Use

Use it in delegate-based endpoints (ProduceAsync/ConsumeAsync) when constructing custom payload envelopes for consistent tracking-id extraction.

Feature Usage Samples

How to use snippets for Tracking Payload Builder.

Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.

Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.

TrackingPayloadBuilder

var builder = new TrackingPayloadBuilder
{
    ContentType = "application/json",
    MessagePayloadType = typeof(object)
};

builder.Headers["X-Correlation-Id"] = "trk-1";
builder.SetBody("""{"trackingId":"trk-1"}""");
var payload = builder.Build();

Use

Headers

Set message headers in one place before the payload is handed to a delegate or custom adapter.

Body

Provide JSON, text, or binary data with the exact body bytes that the downstream adapter should publish.

Typed parsing

Set MessagePayloadType and JSON settings when tracking selectors should parse the payload as a known object shape.