use of org.apache.kafka.streams.processor.internals.RecordContext in project kafka by apache.
the class CachingKeyValueStore method putAndMaybeForward.
private void putAndMaybeForward(final ThreadCache.DirtyEntry entry, final InternalProcessorContext context) {
final RecordContext current = context.recordContext();
try {
context.setRecordContext(entry.recordContext());
if (flushListener != null) {
flushListener.apply(serdes.keyFrom(entry.key().get()), serdes.valueFrom(entry.newValue()), serdes.valueFrom(underlying.get(entry.key())));
}
underlying.put(entry.key(), entry.newValue());
} finally {
context.setRecordContext(current);
}
}
use of org.apache.kafka.streams.processor.internals.RecordContext in project kafka by apache.
the class CachingSessionStore method putAndMaybeForward.
private void putAndMaybeForward(final ThreadCache.DirtyEntry entry, final InternalProcessorContext context) {
final Bytes binaryKey = entry.key();
final RecordContext current = context.recordContext();
context.setRecordContext(entry.recordContext());
try {
final Windowed<K> key = SessionKeySerde.from(binaryKey.get(), keySerde.deserializer());
if (flushListener != null) {
final AGG newValue = serdes.valueFrom(entry.newValue());
final AGG oldValue = fetchPrevious(binaryKey);
if (!(newValue == null && oldValue == null)) {
flushListener.apply(key, newValue == null ? null : newValue, oldValue);
}
}
bytesStore.put(new Windowed<>(Bytes.wrap(serdes.rawKey(key.key())), key.window()), entry.newValue());
} finally {
context.setRecordContext(current);
}
}
use of org.apache.kafka.streams.processor.internals.RecordContext in project kafka by apache.
the class CachingWindowStore method maybeForward.
private void maybeForward(final ThreadCache.DirtyEntry entry, final Bytes key, final Windowed<K> windowedKey, final InternalProcessorContext context) {
if (flushListener != null) {
final RecordContext current = context.recordContext();
context.setRecordContext(entry.recordContext());
try {
flushListener.apply(windowedKey, serdes.valueFrom(entry.newValue()), fetchPrevious(key, windowedKey.window().start()));
} finally {
context.setRecordContext(current);
}
}
}
Aggregations