private ConsumeResult<K, V> ReadRecord() { try { var record = pipe.Read(); var key = keySerdes != null ? keySerdes.Deserialize(record.Key, new SerializationContext(MessageComponentType.Key, pipe.TopicName)) : (K)configuration.DefaultKeySerDes.DeserializeObject(record.Key, new SerializationContext(MessageComponentType.Key, pipe.TopicName)); var value = valueSerdes != null ? valueSerdes.Deserialize(record.Value, new SerializationContext(MessageComponentType.Value, pipe.TopicName)) : (V)configuration.DefaultValueSerDes.DeserializeObject(record.Value, new SerializationContext(MessageComponentType.Value, pipe.TopicName)); return new ConsumeResult<K, V>{ Message = new Message<K, V> { Key = key, Value = value, Timestamp = record.Message.Timestamp, Headers = record.Message.Headers }, Offset = record.Offset, Partition = record.Partition, Topic = record.Topic, IsPartitionEOF = record.IsPartitionEOF }; }catch(StreamsException e) { log.LogWarning(e, "{Message}", e.Message); return null; } }
private TestRecord <K, V> ReadRecord() { try { var record = pipe.Read(); var key = keySerdes != null?keySerdes.Deserialize(record.Key) : (K)configuration.DefaultKeySerDes.DeserializeObject(record.Key); var value = valueSerdes != null?valueSerdes.Deserialize(record.Value) : (V)configuration.DefaultValueSerDes.DeserializeObject(record.Value); return(new TestRecord <K, V> { Key = key, Value = value }); }catch (StreamsException e) { log.Warn($"{e.Message}"); return(null); } }