-
Notifications
You must be signed in to change notification settings - Fork 1
Event Annotations
Requests can be marked with RequestResponseMetaType.Event to give them special styling in diagrams. Event-annotated notes are rendered with:
- A light blue background (
#cfecf7) - Smaller font size (11px)
- Rounded corners
This is useful for distinguishing asynchronous events, webhooks, or message bus interactions from standard HTTP request/response flows.
The MessageTracker class makes it easy to log non-HTTP interactions — such as events, messages, or commands sent via Kafka, EventGrid, RabbitMQ, SNS, or any other transport — so they appear in the generated sequence diagrams alongside regular HTTP traffic.
Register MessageTracker in your WebApplicationFactory startup, alongside your existing tracking setup:
builder.ConfigureTestServices(services =>
{
services.TrackDependenciesForDiagrams(new XUnitTestTrackingMessageHandlerOptions { ... });
services.TrackMessagesForDiagrams(callingServiceName: "My API");
});This registers MessageTracker as a singleton in DI, along with IHttpContextAccessor (needed to read test-tracking headers from the current request context).
Inject MessageTracker into any fake or stub that simulates publishing or sending messages. Call TrackMessageRequest when the message is sent, and TrackMessageResponse when the publish completes:
public class FakeEventPublisher : IEventPublisher
{
private readonly MessageTracker _tracker;
public FakeEventPublisher(MessageTracker tracker)
{
_tracker = tracker;
}
public Task PublishAsync(OrderCreatedEvent @event)
{
var correlationId = _tracker.TrackMessageRequest(
protocol: "Kafka",
destinationName: "Order Service",
destinationUri: new Uri("kafka://order-events"),
payload: @event);
_tracker.TrackMessageResponse(
protocol: "Kafka",
destinationName: "Order Service",
destinationUri: new Uri("kafka://order-events"),
requestResponseId: correlationId);
return Task.CompletedTask;
}
}| Parameter | Description |
|---|---|
protocol |
The transport label shown in the diagram (e.g. "Kafka", "EventGrid", "SNS", "RabbitMQ"). |
destinationName |
The name of the destination service or topic shown in the diagram. |
destinationUri |
A URI representing the destination (e.g. new Uri("kafka://order-events")). |
payload |
The message payload — serialised to JSON and shown in the diagram note. |
requestResponseId |
The correlation ID returned by TrackMessageRequest, used to pair the request and response. |
responsePayload |
Optional response payload for TrackMessageResponse (e.g. an acknowledgement). |
If your payloads require specific serialisation settings, pass JsonSerializerOptions to the registration:
services.TrackMessagesForDiagrams(
callingServiceName: "My API",
serializerOptions: new JsonSerializerOptions { WriteIndented = true });Getting Started
Common Tasks
Integration Guides
- Integration xUnit3
- Integration xUnit2
- Integration NUnit
- Integration MSTest
- Integration TUnit
- Integration BDDfy xUnit3
- Integration LightBDD xUnit2
- Integration LightBDD xUnit3
- Integration LightBDD TUnit
- Integration ReqNRoll xUnit2
- Integration ReqNRoll xUnit3
- Integration ReqNRoll TUnit
Extensions
- Integration AtlasDataApi Extension
- Integration BigQuery Extension
- Integration Bigtable Extension
- Integration BlobStorage Extension
- Integration ClickHouse Extension
- Integration CloudStorage Extension
- Integration CosmosDB Extension
- Integration Dapper Extension
- Integration DynamoDB Extension
- Integration EF Core Relational Extension
- Integration Elasticsearch Extension
- Integration EventBridge Extension
- Integration EventHubs Extension
- Integration Grpc Extension
- Integration Kafka Extension
- Integration MassTransit Extension
- Integration MongoDB Extension
- Integration MySqlConnector Extension
- Integration Npgsql Extension
- Integration Oracle Extension
- Integration PubSub Extension
- Integration Redis Extension
- Integration S3 Extension
- Integration ServiceBus Extension
- Integration SNS Extension
- Integration Spanner Extension
- Integration SqlClient Extension
- Integration Sqlite Extension
- Integration SQS Extension
- Integration StorageQueues Extension
- Integration OpenTelemetry Extension
- Integration DispatchProxy Extension
- Integration MediatR Extension
- Integration PlantUML IKVM
Configuration
- Tracking Dependencies
- Tracking Custom Dependencies
- HTTP Tracking Setup
- Report Configuration
- Diagram Customisation
- Phase-Aware Tracking
- Content Formatting
- PlantUML Server Configuration
Features
- Generated Reports
- Search Syntax
- Component Diagrams
- PlantUML Browser Rendering
- Inline SVG Rendering
- Internal Flow Tracking
- Tags and Attributes
- Excluding Requests
- Excluded Headers
- Multi-Host Test Architectures
- Event-Driven Architecture Testing
- Service Bus Tracking Patterns
- Background Thread Correlation
- Parallel-Safe Background Correlation
- Event & Message Tracking
- Assertion Tracking
- Step Tracking
- Tabular Attributes
- Large Response and Diagram Handling
- Diagnostics and Debugging
- CI Summary Integration
- CI Artifact Upload
- Merging Parallel Reports
Reference