fork download
  1. import kafka.producer.Partitioner;
  2.  
  3. /**
  4.  * Created by nim_13512065 on 10/1/15.
  5.  */
  6. public class SimplePartitioner implements Partitioner {
  7. public SimplePartitioner() {
  8.  
  9. }
  10. @Override
  11. public int partition(Object o, int i) {
  12. int partition = 0;
  13. String stringKey = (String) o;
  14. int offset = stringKey.lastIndexOf('.');
  15. if (offset > 0) {
  16. partition = Integer.parseInt( stringKey.substring(offset+1)) % i;
  17. }
  18. return partition;
  19. }
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class SimplePartitioner is public, should be declared in a file named SimplePartitioner.java
public class SimplePartitioner implements Partitioner {
       ^
Main.java:1: error: package kafka.producer does not exist
import kafka.producer.Partitioner;
                     ^
Main.java:6: error: cannot find symbol
public class SimplePartitioner implements Partitioner {
                                          ^
  symbol: class Partitioner
Main.java:10: error: method does not override or implement a method from a supertype
    @Override
    ^
4 errors
stdout
Standard output is empty