Does anyone have a working example of a Samza job using an InitableTask?
It wasn't clear from the documentation what ways to specify the input
parameters to the init() method. Is it a matter of adding lines in the config
file that look like:
task.foo.bar = someVal
?
Also, when I tried to run a simple example with an InitableTask, I get an
error. It seems there is some problem when Samza attempts to instantiate the
class
Here is the sample task I am trying to run:
public class SimpleSamzaTask implements InitableTask {
private static final SystemStream OUTPUT_STREAM =
new SystemStream("kafka", "simpleout");
public SimpleSamzaTask(){
super();
}
public void process(IncomingMessageEnvelope envelope, MessageCollector
collector, TaskCoordinator coordinator) {
System.out.println("hello world");
collector.send(new OutgoingMessageEnvelope(OUTPUT_STREAM, "hello: " +
envelope.getMessage()));
}
@Override
public void init(Config arg0, TaskContext arg1) throws Exception {
// TODO Auto-generated method stub
System.out.println("in init");
}
}
Thoughts?