protected void produceMessages(final int start, String topic, int numMessages) {
    for (int i = start; i < numMessages + start; i++) {
      try {
        LOG.info("producing " + i);
        producer.send(new ProducerRecord(topic, i % 2, String.valueOf(i), String.valueOf(i).getBytes())).get();
      } catch (InterruptedException | ExecutionException e) {
        e.printStackTrace();
      }
    }
  }
Produces the provided number of messages to the topic.
samza-test/src/test/java/org/apache/samza/processor/TestZkStreamProcessorBase.java