-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/197
- Loading branch information
Showing
48 changed files
with
604 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Streamiz.Kafka.Net.Processors | ||
{ | ||
/// <summary> | ||
/// An interface that allows to dynamically determine the timestamp of the record stored in the Kafka topic. | ||
/// </summary> | ||
/// <typeparam name="K">Key type</typeparam> | ||
/// <typeparam name="V">Value type</typeparam> | ||
public interface IRecordTimestampExtractor<K,V> | ||
{ | ||
/// <summary> | ||
/// Extracts the timestamp of the record stored in the Kafka topic. | ||
/// </summary> | ||
/// <param name="key">the record key</param> | ||
/// <param name="value">the record value</param> | ||
/// <param name="recordContext">current context metadata of the record</param> | ||
/// <returns>the timestamp of the record</returns> | ||
long Extract(K key, V value, IRecordContext recordContext); | ||
|
||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
core/Processors/Internal/DefaultRecordTimestampExtractor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace Streamiz.Kafka.Net.Processors.Internal | ||
{ | ||
internal class DefaultRecordTimestampExtractor<K, V> : IRecordTimestampExtractor<K, V> | ||
{ | ||
private readonly Func<K, V, IRecordContext, long> timestampExtractor; | ||
|
||
public DefaultRecordTimestampExtractor() | ||
{ | ||
this.timestampExtractor = (k, v, ctx) => ctx.Timestamp; | ||
} | ||
|
||
public long Extract(K key, V value, IRecordContext recordContext) => timestampExtractor(key, value, recordContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
core/Processors/Internal/WrapperRecordTimestampExtractor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace Streamiz.Kafka.Net.Processors.Internal | ||
{ | ||
internal class WrapperRecordTimestampExtractor<K, V> : IRecordTimestampExtractor<K, V> | ||
{ | ||
private readonly Func<K, V, IRecordContext, long> timestampExtractor; | ||
|
||
public WrapperRecordTimestampExtractor(Func<K,V,IRecordContext,long> timestampExtractor) | ||
{ | ||
this.timestampExtractor = timestampExtractor; | ||
} | ||
|
||
public long Extract(K key, V value, IRecordContext recordContext) => timestampExtractor(key, value ,recordContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.