@Override public Windowed<K> peekNextKey() { final Bytes bytes = bytesIterator.peekNextKey(); return SessionKeySchema.from(bytes.get(), serdes.keyDeserializer(), serdes.topic()); }
public static <K> Windowed<K> fromStoreKey(final byte[] binaryKey, final long windowSize, final StateSerdes<K, ?> serdes) { final K key = serdes.keyDeserializer().deserialize(serdes.topic(), extractStoreKeyBytes(binaryKey)); final Window window = extractStoreWindow(binaryKey, windowSize); return new Windowed<>(key, window); }
@Override public KeyValue<Windowed<K>, V> next() { final KeyValue<Bytes, byte[]> next = bytesIterator.next(); return KeyValue.pair(SessionKeySchema.from(next.key.get(), serdes.keyDeserializer(), serdes.topic()), serdes.valueFrom(next.value)); }
private void putAndMaybeForward(final ThreadCache.DirtyEntry entry, final InternalProcessorContext context) { final Bytes binaryKey = cacheFunction.key(entry.key()); final ProcessorRecordContext current = context.recordContext(); context.setRecordContext(entry.entry().context()); try { final Windowed<K> key = SessionKeySchema.from(binaryKey.get(), serdes.keyDeserializer(), topic); final Bytes rawKey = Bytes.wrap(serdes.rawKey(key.key())); if (flushListener != null) { final AGG newValue = serdes.valueFrom(entry.newValue()); final AGG oldValue = newValue == null || sendOldValues ? fetchPrevious(rawKey, key.window()) : null; if (!(newValue == null && oldValue == null)) { flushListener.apply(key, newValue, oldValue); } } bytesStore.put(new Windowed<>(rawKey, key.window()), entry.newValue()); } finally { context.setRecordContext(current); } }