public override void Process(K key, V value) { LogProcessingKeyValue(key, value); if (key == null) { log.Warn($"Skipping record due to null key. topic=[{Context.Topic}] partition=[{Context.Partition}] offset=[{Context.Offset}]"); return; } if (queryableName != null) { ValueAndTimestamp <V> oldValueAndTimestamp = store.Get(key); V oldValue; if (oldValueAndTimestamp != null) { oldValue = oldValueAndTimestamp.Value; if (Context.Timestamp < oldValueAndTimestamp.Timestamp) { log.Warn($"Detected out-of-order KTable update for {store.Name} at offset {Context.Offset}, partition {Context.Partition}."); } } else { oldValue = default(V); } store.Put(key, ValueAndTimestamp <V> .Make(value, Context.Timestamp)); tupleForwarder.MaybeForward(key, value, oldValue); } else { this.Forward <K, Change <V> >(key, new Change <V>(default(V), value)); } }
public override void Process(K key, V value) { if (key == null || value == null) { log.Warn($"Skipping record due to null key or value. key=[{key}] value=[{value}] topic=[{Context.Topic}] partition=[{Context.Partition}] offset=[{Context.Offset}]"); return; } ValueAndTimestamp <T> oldAggAndTimestamp = store.Get(key); T oldAgg, newAgg; long newTimestamp; if (oldAggAndTimestamp == null) { oldAgg = initializer.Apply(); newTimestamp = Context.Timestamp; } else { oldAgg = oldAggAndTimestamp.Value; newTimestamp = Math.Max(Context.Timestamp, oldAggAndTimestamp.Timestamp); } newAgg = aggregator.Apply(key, value, oldAgg); store.Put(key, ValueAndTimestamp <T> .Make(newAgg, newTimestamp)); tupleForwarder.MaybeForward(key, newAgg, enableSendOldValues ? oldAgg : default, newTimestamp);