private void sendBucketIdsToProcessor() { for (Entry<Integer, Collection<Integer>> entry : bucketToTaskMap.asMap().entrySet()) { int bucketNum = entry.getKey(); for (Integer taskId : entry.getValue()) { // Create payload ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putInt(numBuckets); buffer.putInt(bucketNum); buffer.flip(); // Create the event and send it tez. Tez will route it to appropriate processor CustomProcessorEvent cpEvent = CustomProcessorEvent.create(buffer); context.sendEventToProcessor(Collections.singletonList(cpEvent), taskId); } } }