package com.ngdata.sep.demo;

import com.ngdata.sep.impl.SepConsumer;
import com.ngdata.sep.util.zookeeper.ZkUtil;
import com.ngdata.sep.util.zookeeper.ZooKeeperItf;

import com.ngdata.sep.EventListener;
import com.ngdata.sep.SepEvent;
import com.ngdata.sep.SepModel;
import com.ngdata.sep.impl.SepModelImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.util.Bytes;

/**
 * A simple consumer that just logs the events.
 */
public class LoggingConsumer {
    public static void main(String[] args) throws Exception {
        Configuration conf = HBaseConfiguration.create();
        conf.setBoolean("hbase.replication", true);

        ZooKeeperItf zk = ZkUtil.connect("localhost", 20000);
        SepModel sepModel = new SepModelImpl(zk, conf);

        final String subscriptionName = "logger";

        if (!sepModel.hasSubscription(subscriptionName)) {
            sepModel.addSubscriptionSilent(subscriptionName);
        }

        SepConsumer sepConsumer = new SepConsumer(subscriptionName, System.currentTimeMillis(),
                new EventLogger(), 1, "localhost", zk, conf);

        sepConsumer.start();
        System.out.println("Started");

        while (true) {
            Thread.sleep(Long.MAX_VALUE);
        }
    }

    private static class EventLogger implements EventListener {
        @Override
        public void processEvent(SepEvent sepEvent) {
            System.out.println("Received event:");
            System.out.println("  table = " + Bytes.toString(sepEvent.getTable()));
            System.out.println("  row = " + Bytes.toString(sepEvent.getRow()));
            System.out.println("  payload = " + Bytes.toString(sepEvent.getPayload()));
            System.out.println("  key values = ");
            for (KeyValue kv : sepEvent.getKeyValues()) {
                System.out.println("    " + kv.toString());
            }
        }
    }
}

@@ -23,16 +23,61 @@
 .demo;%0A%0A
+import com.ngdata.sep.impl.PayloadExtractor;%0A
 import c
@@ -1086,24 +1086,188 @@
 %0A        %7D%0A%0A
+        PayloadExtractor payloadExtractor = new PayloadExtractor(Bytes.toBytes(%22sep-user-demo%22), Bytes.toBytes(%22info%22),%0A                Bytes.toBytes(%22payload%22));%0A%0A
         SepC
@@ -1401,32 +1401,50 @@
 lhost%22, zk, conf
+, payloadExtractor
 );%0A%0A        sepC

Enable payloads in logging consumer