Subscribe To Shard
kinesis_subscribe_to_shard | R Documentation |
This operation establishes an HTTP/2 connection between the consumer you specify in the ConsumerARN parameter and the shard you specify in the ShardId parameter¶
Description¶
This operation establishes an HTTP/2 connection between the consumer you
specify in the ConsumerARN
parameter and the shard you specify in the
ShardId
parameter. After the connection is successfully established,
Kinesis Data Streams pushes records from the shard to the consumer over
this connection. Before you call this operation, call
register_stream_consumer
to register the consumer with Kinesis Data
Streams.
When the subscribe_to_shard
call succeeds, your consumer starts
receiving events of type SubscribeToShardEvent over the HTTP/2
connection for up to 5 minutes, after which time you need to call
subscribe_to_shard
again to renew the subscription if you want to
continue to receive records.
You can make one call to subscribe_to_shard
per second per registered
consumer per shard. For example, if you have a 4000 shard stream and two
registered stream consumers, you can make one subscribe_to_shard
request per second for each combination of shard and registered
consumer, allowing you to subscribe both consumers to all 4000 shards in
one second.
If you call subscribe_to_shard
again with the same ConsumerARN
and
ShardId
within 5 seconds of a successful call, you'll get a
ResourceInUseException
. If you call subscribe_to_shard
5 seconds or
more after a successful call, the second call takes over the
subscription and the previous connection expires or fails with a
ResourceInUseException
.
For an example of how to use this operation, see Enhanced Fan-Out Using the Kinesis Data Streams API.
Usage¶
Arguments¶
ConsumerARN
[required] For this parameter, use the value you obtained when you called
register_stream_consumer
.ShardId
[required] The ID of the shard you want to subscribe to. To see a list of all the shards for a given stream, use
list_shards
.StartingPosition
[required] The starting position in the data stream from which to start streaming.
Value¶
A list with the following syntax:
list(
EventStream = list(
SubscribeToShardEvent = list(
Records = list(
list(
SequenceNumber = "string",
ApproximateArrivalTimestamp = as.POSIXct(
"2015-01-01"
),
Data = raw,
PartitionKey = "string",
EncryptionType = "NONE"|"KMS"
)
),
ContinuationSequenceNumber = "string",
MillisBehindLatest = 123,
ChildShards = list(
list(
ShardId = "string",
ParentShards = list(
"string"
),
HashKeyRange = list(
StartingHashKey = "string",
EndingHashKey = "string"
)
)
)
),
ResourceNotFoundException = list(
message = "string"
),
ResourceInUseException = list(
message = "string"
),
KMSDisabledException = list(
message = "string"
),
KMSInvalidStateException = list(
message = "string"
),
KMSAccessDeniedException = list(
message = "string"
),
KMSNotFoundException = list(
message = "string"
),
KMSOptInRequired = list(
message = "string"
),
KMSThrottlingException = list(
message = "string"
),
InternalFailureException = list(
message = "string"
)
)
)