use of org.apache.kafka.streams.errors.ProcessorStateException in project kafka by apache.
the class RocksDBStore method putAll.
@Override
public void putAll(List<KeyValue<K, V>> entries) {
try (WriteBatch batch = new WriteBatch()) {
for (KeyValue<K, V> entry : entries) {
final byte[] rawKey = serdes.rawKey(entry.key);
if (entry.value == null) {
db.delete(rawKey);
} else {
final byte[] value = serdes.rawValue(entry.value);
batch.put(rawKey, value);
}
}
db.write(wOptions, batch);
} catch (RocksDBException e) {
throw new ProcessorStateException("Error while batch writing to store " + this.name, e);
}
}
use of org.apache.kafka.streams.errors.ProcessorStateException in project kafka by apache.
the class AbstractTask method initializeOffsetLimits.
protected void initializeOffsetLimits() {
for (TopicPartition partition : partitions) {
try {
// TODO: batch API?
OffsetAndMetadata metadata = consumer.committed(partition);
stateMgr.putOffsetLimit(partition, metadata != null ? metadata.offset() : 0L);
} catch (AuthorizationException e) {
throw new ProcessorStateException(String.format("task [%s] AuthorizationException when initializing offsets for %s", id, partition), e);
} catch (WakeupException e) {
throw e;
} catch (KafkaException e) {
throw new ProcessorStateException(String.format("task [%s] Failed to initialize offsets for %s", id, partition), e);
}
}
}
use of org.apache.kafka.streams.errors.ProcessorStateException in project kafka by apache.
the class ProcessorStateManager method flush.
@Override
public void flush(final InternalProcessorContext context) {
if (!this.stores.isEmpty()) {
log.debug("{} Flushing all stores registered in the state manager", logPrefix);
for (StateStore store : this.stores.values()) {
try {
log.trace("{} Flushing store={}", logPrefix, store.name());
store.flush();
} catch (Exception e) {
throw new ProcessorStateException(String.format("%s Failed to flush state store %s", logPrefix, store.name()), e);
}
}
}
}
Aggregations