Skip to content

How to alias channels in Aeron

Problem

  • You have many channels in use, and you want to easily identify them
  • You want to capture Aeron counters for specific channels
  • You want an easy way to find a given Aeron Archive

Solution

Add aliases to the channel definition.

Discussion

Aliases can be used to help identify channels programmatically. Aeron channels support multiple parameters.

To add an alias, add or append the alias keyword.

  • aeron:ipc?alias=abc IPC channel, with alias as the first parameter
  • aeron:udp?endpoint=192.168.0.1:12345|alias=def UDP channel, with the alias as the 2nd parameter.

These aliases will appear in AeronStat output.

Reading the channel alias in a counter

1
2
3
4
5
6
7
8
final CountersReader counters = aeron.countersReader();

counters.forEach(
    (counterId, typeId, keyBuffer, label) ->
    {
        //label will contain the alias (along with other values)
    }
);

Finding an archive with alias

Aeron Archive's listRecordingsForUri accepts a channel fragment parameter. You can include the alias in this:

1
2
3
4
5
6
7
aeronArchive.listRecordingsForUri(
    0,
    maxRecordCount,
    channelFragment,
    streamId,
    this
    );

See Also