Message tracking storage

Hermes can store trace of each event pass through system for selected topics and subscriptions. Information stored in trace are described in subscribing guide. This section shows how to configure trace storage.

Trace data is important, but not critical in Hermes. The number one priority is to keep Hermes core functionality - receiving and sending messages - stable. Thus in case of trace storage downtime or malfunction, internal queues might overflow and information will be lost. Each time it happens logs are emitted. There are also metrics that allow monitoring current trace message queue capacity.


This is the preferred storage for traces. Trace information is append only and for optimal performance should be written in batches, which is an ideal case for ElasticSearch.

Information is stored in daily-rolled indexes:

They are accessed via sent_messages and published_messages aliases respectively. There is no index deletion policy - it is up to ElasticSearch owner to implement one.

To use it, import hermes-tracker-elasticsearch module:

compile group: '', name: 'hermes-tracker-elasticsearch', version:

in Frontend, Consumers and Management.

Frontend configuration

Example of usage with example configuration (there are no config.get* methods out of box!):

ElasticsearchClientFactory elasticFactory = new ElasticsearchClientFactory(

builder.withLogRepository(serviceLocator ->
    new FrontendElasticsearchLogRepository.Builder(

Consumers configuration

Consumers module is configured in the same way as Frontend, except for log repository which is created using ConsumersElastisearchLogReposiory.Builder.

Management configuration

Make bean implementing available in Spring context:

LogRepository logRepository(Client client) {
    return new ElasticsearchLogRepository(client);


There is an option to use MongoDB as trace storage, but it is not recommended, at least with Mongo 2.x. We found that even under relatively low load there were problems with writing batches of trace data and retrieving information.