-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Souvik Bose <[email protected]>
- Loading branch information
Showing
30 changed files
with
301 additions
and
388 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
17 changes: 0 additions & 17 deletions
17
...g/opensearch/dataprepper/plugins/kinesis/extension/DefaultKinesisLeaseConfigSupplier.java
This file was deleted.
Oops, something went wrong.
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
29 changes: 29 additions & 0 deletions
29
.../org/opensearch/dataprepper/plugins/kinesis/source/HostNameWorkerIdentifierGenerator.java
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,29 @@ | ||
package org.opensearch.dataprepper.plugins.kinesis.source; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
/** | ||
* Generate a unique ID to represent a consumer application instance. | ||
*/ | ||
public class HostNameWorkerIdentifierGenerator implements WorkerIdentifierGenerator { | ||
|
||
private static final String hostName; | ||
|
||
static { | ||
try { | ||
hostName = InetAddress.getLocalHost().getHostName(); | ||
} catch (final UnknownHostException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return Default to use host name. | ||
*/ | ||
@Override | ||
public String generate() { | ||
return hostName; | ||
} | ||
} |
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
26 changes: 2 additions & 24 deletions
26
...ain/java/org/opensearch/dataprepper/plugins/kinesis/source/WorkerIdentifierGenerator.java
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 |
---|---|---|
@@ -1,28 +1,6 @@ | ||
package org.opensearch.dataprepper.plugins.kinesis.source; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
public interface WorkerIdentifierGenerator { | ||
|
||
/** | ||
* Generate a unique ID to represent a consumer application instance. | ||
*/ | ||
public class WorkerIdentifierGenerator { | ||
|
||
private static final String hostName; | ||
|
||
static { | ||
try { | ||
hostName = InetAddress.getLocalHost().getHostName(); | ||
} catch (final UnknownHostException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return Default to use host name. | ||
*/ | ||
public String generate() { | ||
return hostName; | ||
} | ||
String generate(); | ||
} |
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
37 changes: 37 additions & 0 deletions
37
...earch/dataprepper/plugins/kinesis/source/configuration/InitialPositionInStreamConfig.java
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,37 @@ | ||
package org.opensearch.dataprepper.plugins.kinesis.source.configuration; | ||
|
||
import lombok.Getter; | ||
import software.amazon.kinesis.common.InitialPositionInStream; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
public enum InitialPositionInStreamConfig { | ||
LATEST("latest", InitialPositionInStream.LATEST), | ||
EARLIEST("earliest", InitialPositionInStream.TRIM_HORIZON); | ||
|
||
private final String position; | ||
|
||
private final InitialPositionInStream positionInStream; | ||
|
||
InitialPositionInStreamConfig(final String position, final InitialPositionInStream positionInStream) { | ||
this.position = position; | ||
this.positionInStream = positionInStream; | ||
} | ||
|
||
private static final Map<String, InitialPositionInStreamConfig> POSITIONS_MAP = Arrays.stream(InitialPositionInStreamConfig.values()) | ||
.collect(Collectors.toMap( | ||
value -> value.position, | ||
value -> value | ||
)); | ||
|
||
public static InitialPositionInStreamConfig fromPositionValue(final String position) { | ||
return POSITIONS_MAP.get(position.toLowerCase()); | ||
} | ||
|
||
public String toString() { | ||
return this.position; | ||
} | ||
} |
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.