topicEncoder = compression => async ({
  topic,
  partitions,
  transactionalId,
  producerId,
  producerEpoch,
}) => {
  const encodePartitions = partitionsEncoder(compression)
  const encodedPartitions = []

  for (const data of partitions) {
    encodedPartitions.push(
      await encodePartitions({ ...data, transactionalId, producerId, producerEpoch })
    )
  }

  return new Encoder().writeString(topic).writeArray(encodedPartitions)
}
@param [transactionalId=null] {String} The transactional id or null if the producer is not transactional
@param acks {Integer} See producer request v0
@param timeout {Integer} See producer request v0
@param [compression=CompressionTypes.None] {CompressionTypes}
@param topicData {Array}