Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
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
RegisterStreamConsumer to register the consumer with Kinesis Data
Streams.
When the SubscribeToShard
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
SubscribeToShard
again to renew the subscription if you want to
continue to receive records.
You can make one call to SubscribeToShard
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 SubscribeToShard
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 SubscribeToShard
again with the same ConsumerARN
and
ShardId
within 5 seconds of a successful call, you'll get a
ResourceInUseException
. If you call SubscribeToShard
5 seconds or
more after a successful call, the first connection will expire and the
second call will take over the subscription.
For an example of how to use this operations, see Enhanced Fan-Out Using the Kinesis Data Streams API.
Synopsis
- data SubscribeToShard = SubscribeToShard' {}
- newSubscribeToShard :: Text -> Text -> StartingPosition -> SubscribeToShard
- subscribeToShard_consumerARN :: Lens' SubscribeToShard Text
- subscribeToShard_shardId :: Lens' SubscribeToShard Text
- subscribeToShard_startingPosition :: Lens' SubscribeToShard StartingPosition
- data SubscribeToShardResponse = SubscribeToShardResponse' {
- httpStatus :: Int
- eventStream :: Value
- newSubscribeToShardResponse :: Int -> Value -> SubscribeToShardResponse
- subscribeToShardResponse_httpStatus :: Lens' SubscribeToShardResponse Int
- subscribeToShardResponse_eventStream :: Lens' SubscribeToShardResponse Value
Creating a Request
data SubscribeToShard Source #
See: newSubscribeToShard
smart constructor.
SubscribeToShard' | |
|
Instances
:: Text | |
-> Text | |
-> StartingPosition | |
-> SubscribeToShard |
Create a value of SubscribeToShard
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:consumerARN:SubscribeToShard'
, subscribeToShard_consumerARN
- For this parameter, use the value you obtained when you called
RegisterStreamConsumer.
$sel:shardId:SubscribeToShard'
, subscribeToShard_shardId
- The ID of the shard you want to subscribe to. To see a list of all the
shards for a given stream, use ListShards.
$sel:startingPosition:SubscribeToShard'
, subscribeToShard_startingPosition
-
Request Lenses
subscribeToShard_consumerARN :: Lens' SubscribeToShard Text Source #
For this parameter, use the value you obtained when you called RegisterStreamConsumer.
subscribeToShard_shardId :: Lens' SubscribeToShard Text Source #
The ID of the shard you want to subscribe to. To see a list of all the shards for a given stream, use ListShards.
Destructuring the Response
data SubscribeToShardResponse Source #
See: newSubscribeToShardResponse
smart constructor.
SubscribeToShardResponse' | |
|
Instances
Generic SubscribeToShardResponse Source # | |
Defined in Amazonka.Kinesis.SubscribeToShard type Rep SubscribeToShardResponse :: Type -> Type # | |
NFData SubscribeToShardResponse Source # | |
Defined in Amazonka.Kinesis.SubscribeToShard rnf :: SubscribeToShardResponse -> () # | |
type Rep SubscribeToShardResponse Source # | |
Defined in Amazonka.Kinesis.SubscribeToShard type Rep SubscribeToShardResponse = D1 ('MetaData "SubscribeToShardResponse" "Amazonka.Kinesis.SubscribeToShard" "libZSservicesZSamazonka-kinesisZSamazonka-kinesis" 'False) (C1 ('MetaCons "SubscribeToShardResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "eventStream") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Value))) |
newSubscribeToShardResponse Source #
:: Int | |
-> Value | |
-> SubscribeToShardResponse |
Create a value of SubscribeToShardResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:httpStatus:SubscribeToShardResponse'
, subscribeToShardResponse_httpStatus
- The response's http status code.
$sel:eventStream:SubscribeToShardResponse'
, subscribeToShardResponse_eventStream
- The event stream that your consumer can use to read records from the
shard.
Response Lenses
subscribeToShardResponse_httpStatus :: Lens' SubscribeToShardResponse Int Source #
The response's http status code.
subscribeToShardResponse_eventStream :: Lens' SubscribeToShardResponse Value Source #
The event stream that your consumer can use to read records from the shard.