Queue message history
Nexus can keep track of the history of messages with identify. This means that you get a full audit trail of the content of the messages, when they change and what changed on them.
Message history is disabled by default in Nexus since the history can grow a lot which can become costly. You can enable history on all queues where the queue message implements IQueueMessageWithId
by configuring it when initializing the queue system:
builder.Services.AddNexus().AddQueues(options =>
{
// History will be stored forever on all queues with ids
options.DefaultHistoryRetention = TimeSpan.MaxValue;
});
This will set the default retention which can then be overriden per queue using the [Queue]
attribute:
[Queue("myqueue", HistoryRetention = "30.00:00:00")]
The above will store the history for that queue for 30 days. The string is a TimeSpan
in string format but also supports the special forever
value to represent TimeSpan.MaxValue
.
Accessing the history
You can access the history in the admin UI when going into a queue and selecting a queue message. The button to show message history will only be visible for queues with identity and where the history retention is not set to TimeSpan.MinValue
.
You can also access the message history using the API endpoint GET /api/queues/:queueName/:messageId/history
.