Search in sources :

Example 1 with KafkaFetchFlushExFW

use of io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW in project zilla by aklivity.

the class KafkaFunctionsTest method shouldGenerateFetchFlushExtensionWithLatestOffset.

@Test
public void shouldGenerateFetchFlushExtensionWithLatestOffset() {
    byte[] build = KafkaFunctions.flushEx().typeId(0x01).fetch().partition(0, 1L, 1L).build().build();
    DirectBuffer buffer = new UnsafeBuffer(build);
    KafkaFlushExFW flushEx = new KafkaFlushExFW().wrap(buffer, 0, buffer.capacity());
    assertEquals(0x01, flushEx.typeId());
    final KafkaFetchFlushExFW fetchFlushEx = flushEx.fetch();
    final KafkaOffsetFW partition = fetchFlushEx.partition();
    assertEquals(0, partition.partitionId());
    assertEquals(1L, partition.partitionOffset());
    assertEquals(1L, partition.latestOffset());
}
Also used : DirectBuffer(org.agrona.DirectBuffer) KafkaOffsetFW(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaOffsetFW) KafkaFetchFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW) KafkaFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFlushExFW) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Test(org.junit.Test)

Example 2 with KafkaFetchFlushExFW

use of io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW in project zilla by aklivity.

the class KafkaFunctionsTest method shouldGenerateFetchFlushExtension.

@Test
public void shouldGenerateFetchFlushExtension() {
    byte[] build = KafkaFunctions.flushEx().typeId(0x01).fetch().partition(0, 1L).build().build();
    DirectBuffer buffer = new UnsafeBuffer(build);
    KafkaFlushExFW flushEx = new KafkaFlushExFW().wrap(buffer, 0, buffer.capacity());
    assertEquals(0x01, flushEx.typeId());
    final KafkaFetchFlushExFW fetchFlushEx = flushEx.fetch();
    final KafkaOffsetFW partition = fetchFlushEx.partition();
    assertEquals(0, partition.partitionId());
    assertEquals(1L, partition.partitionOffset());
}
Also used : DirectBuffer(org.agrona.DirectBuffer) KafkaOffsetFW(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaOffsetFW) KafkaFetchFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW) KafkaFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFlushExFW) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Test(org.junit.Test)

Aggregations

KafkaOffsetFW (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaOffsetFW)2 KafkaFetchFlushExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW)2 KafkaFlushExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFlushExFW)2 DirectBuffer (org.agrona.DirectBuffer)2 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)2 Test (org.junit.Test)2