Skip to content

Instantly share code, notes, and snippets.

@gabriel-tincu
Last active October 26, 2020 23:13
Show Gist options
  • Save gabriel-tincu/9e9fd152666a2364b7587e7d0b456f8c to your computer and use it in GitHub Desktop.
Save gabriel-tincu/9e9fd152666a2364b7587e7d0b456f8c to your computer and use it in GitHub Desktop.
@Test
public void testListPartitionReassignmentsResponse() {
List<ListPartitionReassignmentsRequestData.ListPartitionReassignmentsTopics> topList = new ArrayList<>();
ListPartitionReassignmentsRequestData.ListPartitionReassignmentsTopics top = new ListPartitionReassignmentsRequestData.ListPartitionReassignmentsTopics().setName("fooTopic");
topList.add(top);
List<Integer> parts = new ArrayList<>();
parts.add(10);
top.setPartitionIndexes(parts);
ListPartitionReassignmentsRequest r = new ListPartitionReassignmentsRequest.Builder(new ListPartitionReassignmentsRequestData().setTimeoutMs(10000).setTopics(topList)).build();
ByteBuffer bb = r.serialize(new RequestHeader(ApiKeys.LIST_PARTITION_REASSIGNMENTS, (short) 0, "foo-client", (short) 0));
byte[] arr = bb.array();
for (byte b : arr) {
System.out.printf("%d ", b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment