Search in sources :

Example 1 with KafkaProduceBeginExFW

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

the class KafkaFunctionsTest method shouldGenerateProduceBeginExtension.

@Test
public void shouldGenerateProduceBeginExtension() {
    byte[] build = KafkaFunctions.beginEx().typeId(0x01).produce().transaction("transaction").topic("topic").partition(1, 0).build().build();
    DirectBuffer buffer = new UnsafeBuffer(build);
    KafkaBeginExFW beginEx = new KafkaBeginExFW().wrap(buffer, 0, buffer.capacity());
    assertEquals(0x01, beginEx.typeId());
    assertEquals(KafkaApi.PRODUCE.value(), beginEx.kind());
    final KafkaProduceBeginExFW produceBeginEx = beginEx.produce();
    assertEquals("transaction", produceBeginEx.transaction().asString());
    assertEquals(1, produceBeginEx.partition().partitionId());
    assertEquals("topic", produceBeginEx.topic().asString());
    assertEquals(0, produceBeginEx.partition().partitionOffset());
}
Also used : DirectBuffer(org.agrona.DirectBuffer) KafkaProduceBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaProduceBeginExFW) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) KafkaBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBeginExFW) Test(org.junit.Test)

Aggregations

KafkaBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBeginExFW)1 KafkaProduceBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaProduceBeginExFW)1 DirectBuffer (org.agrona.DirectBuffer)1 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)1 Test (org.junit.Test)1