Search in sources :

Example 1 with TreasureDataSender

use of org.komamitsu.fluency.treasuredata.ingester.sender.TreasureDataSender in project fluency by komamitsu.

the class FluencyBuilderForTreasureDataTest method buildWithAllCustomConfig.

@Test
void buildWithAllCustomConfig() throws IOException {
    String tmpdir = System.getProperty("java.io.tmpdir");
    assertNotNull(tmpdir);
    FluencyBuilderForTreasureData builder = new FluencyBuilderForTreasureData();
    builder.setFlushAttemptIntervalMillis(200);
    builder.setMaxBufferSize(Long.MAX_VALUE);
    builder.setBufferChunkInitialSize(7 * 1024 * 1024);
    builder.setBufferChunkRetentionSize(13 * 1024 * 1024);
    builder.setBufferChunkRetentionTimeMillis(19 * 1000);
    builder.setJvmHeapBufferMode(true);
    builder.setWaitUntilBufferFlushed(42);
    builder.setWaitUntilFlusherTerminated(24);
    builder.setFileBackupDir(tmpdir);
    builder.setSenderRetryIntervalMillis(1234);
    builder.setSenderMaxRetryIntervalMillis(345678);
    builder.setSenderRetryFactor(3.14f);
    builder.setSenderRetryMax(17);
    builder.setSenderWorkBufSize(123456);
    ;
    try (Fluency fluency = builder.build(APIKEY)) {
        assertEquals(Buffer.class, fluency.getBuffer().getClass());
        Buffer buffer = fluency.getBuffer();
        assertEquals(Long.MAX_VALUE, buffer.getMaxBufferSize());
        assertEquals(tmpdir, buffer.getFileBackupDir());
        assertEquals("packed_forward", buffer.bufferFormatType());
        assertEquals(19 * 1000, buffer.getChunkRetentionTimeMillis());
        assertEquals(2f, buffer.getChunkExpandRatio());
        assertEquals(7 * 1024 * 1024, buffer.getChunkInitialSize());
        assertEquals(13 * 1024 * 1024, buffer.getChunkRetentionSize());
        assertTrue(buffer.getJvmHeapBufferMode());
        Flusher flusher = fluency.getFlusher();
        assertFalse(flusher.isTerminated());
        assertEquals(200, flusher.getFlushAttemptIntervalMillis());
        assertEquals(42, flusher.getWaitUntilBufferFlushed());
        assertEquals(24, flusher.getWaitUntilTerminated());
        assertEquals(TreasureDataSender.class, flusher.getIngester().getSender().getClass());
        TreasureDataSender sender = (TreasureDataSender) flusher.getIngester().getSender();
        assertEquals(1234, sender.getRetryInternalMs());
        assertEquals(345678, sender.getMaxRetryInternalMs());
        assertEquals(3.14f, sender.getRetryFactor());
        assertEquals(17, sender.getRetryMax());
        assertEquals(123456, sender.getWorkBufSize());
    }
}
Also used : Buffer(org.komamitsu.fluency.buffer.Buffer) Fluency(org.komamitsu.fluency.Fluency) Flusher(org.komamitsu.fluency.flusher.Flusher) TreasureDataSender(org.komamitsu.fluency.treasuredata.ingester.sender.TreasureDataSender) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Fluency (org.komamitsu.fluency.Fluency)1 Buffer (org.komamitsu.fluency.buffer.Buffer)1 Flusher (org.komamitsu.fluency.flusher.Flusher)1 TreasureDataSender (org.komamitsu.fluency.treasuredata.ingester.sender.TreasureDataSender)1