public void logStandbySnapshotNotification(
        final int memberId,
        final long recordingId,
        final long leadershipTermId,
        final long termBaseLogPosition,
        final long logPosition,
        final long timestamp,
        final TimeUnit timeUnit,
        final int serviceId,
        final String archiveEndpoint)
    {
        final int length = ClusterEventEncoder.standbySnapshotNotificationLength(timeUnit, archiveEndpoint);
        final int captureLength = captureLength(length);
        final int encodedLength = encodedLength(captureLength);
        final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
        final int index = ringBuffer.tryClaim(STANDBY_SNAPSHOT_NOTIFICATION.toEventCodeId(), encodedLength);

        if (index > 0)
        {
            try
            {
                ClusterEventEncoder.encodeStandbySnapshotNotification(
                    (UnsafeBuffer)ringBuffer.buffer(),
                    index,
                    captureLength,
                    length,
                    memberId,
                    recordingId,
                    leadershipTermId,
                    termBaseLogPosition,
                    logPosition,
                    timestamp,
                    timeUnit,
                    serviceId,
                    archiveEndpoint);
            }
            finally
            {
                ringBuffer.commit(index);
            }
        }
    }
@Test
    void logStandbySnapshotNotification()
    {
        final int memberId = 222;
        final long recordingId = 9823674L;
        final long leadershipTermId = 23478L;
        final long termBaseLogPosition = 823423L;
        final long logPosition = 9827342L;
        final long timestamp = 98273423434L;
        final int serviceId = 1;
        final String archiveEndpoint = "localhost:9090";
        final int offset = 64;
        final TimeUnit timeUnit = MILLISECONDS;

        logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, offset);
        logger.logStandbySnapshotNotification(
            memberId,
            recordingId,
            leadershipTermId,
            termBaseLogPosition,
            logPosition,
            timestamp,
            timeUnit,
            serviceId,
            archiveEndpoint);

        verifyLogHeader(
            logBuffer,
            offset,
            STANDBY_SNAPSHOT_NOTIFICATION.toEventCodeId(),
            standbySnapshotNotificationLength(timeUnit, archiveEndpoint),
            standbySnapshotNotificationLength(timeUnit, archiveEndpoint));

        final int index = encodedMsgOffset(offset) + LOG_HEADER_LENGTH;
        assertEquals(recordingId, logBuffer.getLong(index, LITTLE_ENDIAN));
        assertEquals(leadershipTermId, logBuffer.getLong(index + SIZE_OF_LONG, LITTLE_ENDIAN));
        assertEquals(termBaseLogPosition, logBuffer.getLong(index + (2 * SIZE_OF_LONG), LITTLE_ENDIAN));
        assertEquals(logPosition, logBuffer.getLong(index + (3 * SIZE_OF_LONG), LITTLE_ENDIAN));
        assertEquals(timestamp, logBuffer.getLong(index + (4 * SIZE_OF_LONG), LITTLE_ENDIAN));
        assertEquals(memberId, logBuffer.getInt(index + (5 * SIZE_OF_LONG), LITTLE_ENDIAN));
        assertEquals(serviceId, logBuffer.getInt(index + (5 * SIZE_OF_LONG) + (SIZE_OF_INT), LITTLE_ENDIAN));

        final int timeUnitIndex = index + (5 * SIZE_OF_LONG) + (2 * SIZE_OF_INT);
        assertEquals(timeUnit.name(), logBuffer.getStringAscii(timeUnitIndex));
        final int archiveEndpointIndex = timeUnitIndex + SIZE_OF_INT + timeUnit.name().length();
        assertEquals(archiveEndpoint, logBuffer.getStringAscii(archiveEndpointIndex, LITTLE_ENDIAN));

        final StringBuilder sb = new StringBuilder();
        ClusterEventDissector.dissectStandbySnapshotNotification(
            STANDBY_SNAPSHOT_NOTIFICATION, logBuffer, encodedMsgOffset(offset), sb);

        final String expectedMessagePattern =
            "\\[[0-9]+\\.[0-9]+] CLUSTER: STANDBY_SNAPSHOT_NOTIFICATION \\[90/90]: memberId=222 " +
            "recordingId=9823674 leadershipTermId=23478 termBaseLeadershipPosition=823423 logPosition=9827342 " +
            "timestamp=98273423434 timeUnit=MILLISECONDS serviceId=1 archiveEndpoint=localhost:9090";

        assertThat(sb.toString(), Matchers.matchesPattern(expectedMessagePattern));
    }