@@ -0,0 +1,3061 @@
+package net.openhft.chronicle.queue.issue;%0A%0Aimport net.openhft.chronicle.core.io.IOTools;%0Aimport net.openhft.chronicle.queue.ChronicleQueue;%0Aimport net.openhft.chronicle.queue.ExcerptAppender;%0Aimport net.openhft.chronicle.queue.ExcerptTailer;%0Aimport net.openhft.chronicle.wire.DocumentContext;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class TailerTest %7B%0A%0A    public static final Path QUEUE_PATH = Paths.get(%22host-1/queue/broker_out%22);%0A    public static final int OFFSET = 3;%0A%0A    @Before%0A    @After%0A    public void cleanupFiles() %7B%0A        IOTools.deleteDirWithFiles(QUEUE_PATH.toFile());%0A    %7D%0A%0A    @Test%0A    public void reproduce() %7B%0A        IOTools.deleteDirWithFiles(QUEUE_PATH.toFile());%0A%0A        long firstOutputIndex = Long.MAX_VALUE;%0A        long lastOutputIndex = Long.MIN_VALUE;%0A%0A        try (ChronicleQueue q = createQueue(); ExcerptAppender appender = q.acquireAppender(); ExcerptTailer tailer = q.createTailer()) %7B%0A            for (int i = 0; i %3C 5; i++) %7B%0A                final String text = %22Hello World %22 + i;%0A                try (DocumentContext dc = appender.writingDocument()) %7B%0A                    dc.wire().writeText(text);%0A                %7D%0A                System.out.format(%22Appended %5C%22%25s%5C%22 at %25d%25n%22, text, appender.lastIndexAppended());%0A                firstOutputIndex = Math.min(firstOutputIndex, appender.lastIndexAppended());%0A                lastOutputIndex = Math.max(lastOutputIndex, appender.lastIndexAppended());%0A            %7D%0A            System.out.format(%22firstOutputIndex = %25d%25n%22, firstOutputIndex);%0A            System.out.format(%22lastOutputIndex = %25d%25n%22, lastOutputIndex);%0A%0A            System.out.println(%22Reading initial%22);%0A            drainTailer(tailer);%0A        %7D%0A%0A        try (ChronicleQueue q = createQueue(); ExcerptTailer tailer = q.createTailer()) %7B%0A            initRecovery(tailer, firstOutputIndex + OFFSET);%0A            final List%3CString%3E messages = drainTailer(tailer);%0A            assertEquals(%22Hello World %22 + OFFSET, messages.get(0));%0A        %7D%0A    %7D%0A%0A    private List%3CString%3E drainTailer(ExcerptTailer tailer) %7B%0A        final List%3CString%3E result = new ArrayList%3C%3E();%0A        for (; ; ) %7B%0A            try (DocumentContext dc = tailer.readingDocument()) %7B%0A                if (!dc.isPresent())%0A                    break;%0A                final String text = dc.wire().readText();%0A                System.out.format(%22Tailed   %5C%22%25s%5C%22 at %25d%25n%22, text, dc.index());%0A                result.add(text);%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    private void initRecovery(ExcerptTailer tailer, long index) %7B%0A        tailer.toStart();%0A        System.out.println(%22Initializing recovery to %22 + index);%0A        if (0 %3C index) %7B%0A            tailer.moveToIndex(index); // Not index + 1%0A        %7D%0A    %7D%0A%0A    private ChronicleQueue createQueue() %7B%0A        return ChronicleQueue.singleBuilder(QUEUE_PATH).build();%0A    %7D%0A%0A%0A%7D

Add tailer index test