@ProcessInput @Batch(100) public void foo(Iterator<StreamEvent> it) { List<StreamEvent> events = ImmutableList.copyOf(it); LOG.warn("Number of batched stream events = " + events.size()); Assert.assertTrue(events.size() > 1); List<Integer> out = Lists.newArrayList(); for (StreamEvent event : events) { out.add(Integer.parseInt(Charsets.UTF_8.decode(event.getBody()).toString())); } LOG.info("Read events=" + out); }
@Override protected void map(LongWritable key, StreamEvent value, Context context) throws IOException, InterruptedException { Text output = new Text(value.getBody().array()); context.write(output, output); }