Search in sources :

Example 6 with StateRestoreCallback

use of org.apache.kafka.streams.processor.StateRestoreCallback in project kafka by apache.

the class RocksDBSegmentedBytesStore method init.

@Override
public void init(ProcessorContext context, StateStore root) {
    this.context = context;
    segments.openExisting(context);
    // register and possibly restore the state from the logs
    context.register(root, false, new StateRestoreCallback() {

        @Override
        public void restore(byte[] key, byte[] value) {
            put(Bytes.wrap(key), value);
        }
    });
    flush();
    open = true;
}
Also used : StateRestoreCallback(org.apache.kafka.streams.processor.StateRestoreCallback)

Aggregations

StateRestoreCallback (org.apache.kafka.streams.processor.StateRestoreCallback)6 OffsetCheckpoint (org.apache.kafka.streams.state.internals.OffsetCheckpoint)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ConsumerRecord (org.apache.kafka.clients.consumer.ConsumerRecord)1 TopicPartition (org.apache.kafka.common.TopicPartition)1 LockException (org.apache.kafka.streams.errors.LockException)1 ProcessorStateException (org.apache.kafka.streams.errors.ProcessorStateException)1 StreamsException (org.apache.kafka.streams.errors.StreamsException)1