Java Code Examples for org.apache.flink.streaming.connectors.kinesis.model.StreamShardMetadata#setStartingSequenceNumber()
The following examples show how to use
org.apache.flink.streaming.connectors.kinesis.model.StreamShardMetadata#setStartingSequenceNumber() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KinesisDataFetcher.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Utility function to convert {@link StreamShardHandle} into {@link StreamShardMetadata}. * * @param streamShardHandle the {@link StreamShardHandle} to be converted * @return a {@link StreamShardMetadata} object */ public static StreamShardMetadata convertToStreamShardMetadata(StreamShardHandle streamShardHandle) { StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamShardHandle.getStreamName()); streamShardMetadata.setShardId(streamShardHandle.getShard().getShardId()); streamShardMetadata.setParentShardId(streamShardHandle.getShard().getParentShardId()); streamShardMetadata.setAdjacentParentShardId(streamShardHandle.getShard().getAdjacentParentShardId()); if (streamShardHandle.getShard().getHashKeyRange() != null) { streamShardMetadata.setStartingHashKey(streamShardHandle.getShard().getHashKeyRange().getStartingHashKey()); streamShardMetadata.setEndingHashKey(streamShardHandle.getShard().getHashKeyRange().getEndingHashKey()); } if (streamShardHandle.getShard().getSequenceNumberRange() != null) { streamShardMetadata.setStartingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getStartingSequenceNumber()); streamShardMetadata.setEndingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getEndingSequenceNumber()); } return streamShardMetadata; }
Example 2
Source File: KinesisDataFetcher.java From flink with Apache License 2.0 | 6 votes |
/** * Utility function to convert {@link StreamShardHandle} into {@link StreamShardMetadata}. * * @param streamShardHandle the {@link StreamShardHandle} to be converted * @return a {@link StreamShardMetadata} object */ public static StreamShardMetadata convertToStreamShardMetadata(StreamShardHandle streamShardHandle) { StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamShardHandle.getStreamName()); streamShardMetadata.setShardId(streamShardHandle.getShard().getShardId()); streamShardMetadata.setParentShardId(streamShardHandle.getShard().getParentShardId()); streamShardMetadata.setAdjacentParentShardId(streamShardHandle.getShard().getAdjacentParentShardId()); if (streamShardHandle.getShard().getHashKeyRange() != null) { streamShardMetadata.setStartingHashKey(streamShardHandle.getShard().getHashKeyRange().getStartingHashKey()); streamShardMetadata.setEndingHashKey(streamShardHandle.getShard().getHashKeyRange().getEndingHashKey()); } if (streamShardHandle.getShard().getSequenceNumberRange() != null) { streamShardMetadata.setStartingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getStartingSequenceNumber()); streamShardMetadata.setEndingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getEndingSequenceNumber()); } return streamShardMetadata; }
Example 3
Source File: KinesisDataFetcher.java From flink with Apache License 2.0 | 6 votes |
/** * Utility function to convert {@link StreamShardHandle} into {@link StreamShardMetadata}. * * @param streamShardHandle the {@link StreamShardHandle} to be converted * @return a {@link StreamShardMetadata} object */ public static StreamShardMetadata convertToStreamShardMetadata(StreamShardHandle streamShardHandle) { StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamShardHandle.getStreamName()); streamShardMetadata.setShardId(streamShardHandle.getShard().getShardId()); streamShardMetadata.setParentShardId(streamShardHandle.getShard().getParentShardId()); streamShardMetadata.setAdjacentParentShardId(streamShardHandle.getShard().getAdjacentParentShardId()); if (streamShardHandle.getShard().getHashKeyRange() != null) { streamShardMetadata.setStartingHashKey(streamShardHandle.getShard().getHashKeyRange().getStartingHashKey()); streamShardMetadata.setEndingHashKey(streamShardHandle.getShard().getHashKeyRange().getEndingHashKey()); } if (streamShardHandle.getShard().getSequenceNumberRange() != null) { streamShardMetadata.setStartingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getStartingSequenceNumber()); streamShardMetadata.setEndingSequenceNumber(streamShardHandle.getShard().getSequenceNumberRange().getEndingSequenceNumber()); } return streamShardMetadata; }
Example 4
Source File: KinesisDataFetcherTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testStreamShardMetadataAndHandleConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata kinesisStreamShard = new StreamShardMetadata(); kinesisStreamShard.setStreamName(streamName); kinesisStreamShard.setShardId(shardId); kinesisStreamShard.setParentShardId(parentShardId); kinesisStreamShard.setAdjacentParentShardId(adjacentParentShardId); kinesisStreamShard.setStartingHashKey(startingHashKey); kinesisStreamShard.setEndingHashKey(endingHashKey); kinesisStreamShard.setStartingSequenceNumber(startingSequenceNumber); kinesisStreamShard.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); StreamShardHandle streamShardHandle = new StreamShardHandle(streamName, shard); assertEquals(kinesisStreamShard, KinesisDataFetcher.convertToStreamShardMetadata(streamShardHandle)); assertEquals(streamShardHandle, KinesisDataFetcher.convertToStreamShardHandle(kinesisStreamShard)); }
Example 5
Source File: FlinkKinesisConsumerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testLegacyKinesisStreamShardToStreamShardMetadataConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamName); streamShardMetadata.setShardId(shardId); streamShardMetadata.setParentShardId(parentShardId); streamShardMetadata.setAdjacentParentShardId(adjacentParentShardId); streamShardMetadata.setStartingHashKey(startingHashKey); streamShardMetadata.setEndingHashKey(endingHashKey); streamShardMetadata.setStartingSequenceNumber(startingSequenceNumber); streamShardMetadata.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); KinesisStreamShard kinesisStreamShard = new KinesisStreamShard(streamName, shard); assertEquals(streamShardMetadata, KinesisStreamShard.convertToStreamShardMetadata(kinesisStreamShard)); }
Example 6
Source File: KinesisDataFetcherTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testStreamShardMetadataAndHandleConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata kinesisStreamShard = new StreamShardMetadata(); kinesisStreamShard.setStreamName(streamName); kinesisStreamShard.setShardId(shardId); kinesisStreamShard.setParentShardId(parentShardId); kinesisStreamShard.setAdjacentParentShardId(adjacentParentShardId); kinesisStreamShard.setStartingHashKey(startingHashKey); kinesisStreamShard.setEndingHashKey(endingHashKey); kinesisStreamShard.setStartingSequenceNumber(startingSequenceNumber); kinesisStreamShard.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); StreamShardHandle streamShardHandle = new StreamShardHandle(streamName, shard); assertEquals(kinesisStreamShard, KinesisDataFetcher.convertToStreamShardMetadata(streamShardHandle)); assertEquals(streamShardHandle, KinesisDataFetcher.convertToStreamShardHandle(kinesisStreamShard)); }
Example 7
Source File: FlinkKinesisConsumerTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLegacyKinesisStreamShardToStreamShardMetadataConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamName); streamShardMetadata.setShardId(shardId); streamShardMetadata.setParentShardId(parentShardId); streamShardMetadata.setAdjacentParentShardId(adjacentParentShardId); streamShardMetadata.setStartingHashKey(startingHashKey); streamShardMetadata.setEndingHashKey(endingHashKey); streamShardMetadata.setStartingSequenceNumber(startingSequenceNumber); streamShardMetadata.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); KinesisStreamShard kinesisStreamShard = new KinesisStreamShard(streamName, shard); assertEquals(streamShardMetadata, KinesisStreamShard.convertToStreamShardMetadata(kinesisStreamShard)); }
Example 8
Source File: KinesisDataFetcherTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testStreamShardMetadataAndHandleConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata kinesisStreamShard = new StreamShardMetadata(); kinesisStreamShard.setStreamName(streamName); kinesisStreamShard.setShardId(shardId); kinesisStreamShard.setParentShardId(parentShardId); kinesisStreamShard.setAdjacentParentShardId(adjacentParentShardId); kinesisStreamShard.setStartingHashKey(startingHashKey); kinesisStreamShard.setEndingHashKey(endingHashKey); kinesisStreamShard.setStartingSequenceNumber(startingSequenceNumber); kinesisStreamShard.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); StreamShardHandle streamShardHandle = new StreamShardHandle(streamName, shard); assertEquals(kinesisStreamShard, KinesisDataFetcher.convertToStreamShardMetadata(streamShardHandle)); assertEquals(streamShardHandle, KinesisDataFetcher.convertToStreamShardHandle(kinesisStreamShard)); }
Example 9
Source File: FlinkKinesisConsumerTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLegacyKinesisStreamShardToStreamShardMetadataConversion() { String streamName = "fakeStream1"; String shardId = "shard-000001"; String parentShardId = "shard-000002"; String adjacentParentShardId = "shard-000003"; String startingHashKey = "key-000001"; String endingHashKey = "key-000010"; String startingSequenceNumber = "seq-0000021"; String endingSequenceNumber = "seq-00000031"; StreamShardMetadata streamShardMetadata = new StreamShardMetadata(); streamShardMetadata.setStreamName(streamName); streamShardMetadata.setShardId(shardId); streamShardMetadata.setParentShardId(parentShardId); streamShardMetadata.setAdjacentParentShardId(adjacentParentShardId); streamShardMetadata.setStartingHashKey(startingHashKey); streamShardMetadata.setEndingHashKey(endingHashKey); streamShardMetadata.setStartingSequenceNumber(startingSequenceNumber); streamShardMetadata.setEndingSequenceNumber(endingSequenceNumber); Shard shard = new Shard() .withShardId(shardId) .withParentShardId(parentShardId) .withAdjacentParentShardId(adjacentParentShardId) .withHashKeyRange(new HashKeyRange() .withStartingHashKey(startingHashKey) .withEndingHashKey(endingHashKey)) .withSequenceNumberRange(new SequenceNumberRange() .withStartingSequenceNumber(startingSequenceNumber) .withEndingSequenceNumber(endingSequenceNumber)); KinesisStreamShard kinesisStreamShard = new KinesisStreamShard(streamName, shard); assertEquals(streamShardMetadata, KinesisStreamShard.convertToStreamShardMetadata(kinesisStreamShard)); }