libZSservicesZSamazonka-kinesisZSamazonka-kinesis
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.Kinesis.SubscribeToShard

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 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

Creating a Request

data SubscribeToShard Source #

See: newSubscribeToShard smart constructor.

Constructors

SubscribeToShard' 

Fields

Instances

Instances details
Eq SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Read SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Show SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Generic SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Associated Types

type Rep SubscribeToShard :: Type -> Type #

NFData SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Methods

rnf :: SubscribeToShard -> () #

Hashable SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

ToJSON SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

AWSRequest SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Associated Types

type AWSResponse SubscribeToShard #

ToHeaders SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

ToPath SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

ToQuery SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

type Rep SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

type Rep SubscribeToShard = D1 ('MetaData "SubscribeToShard" "Amazonka.Kinesis.SubscribeToShard" "libZSservicesZSamazonka-kinesisZSamazonka-kinesis" 'False) (C1 ('MetaCons "SubscribeToShard'" 'PrefixI 'True) (S1 ('MetaSel ('Just "consumerARN") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "shardId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "startingPosition") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 StartingPosition))))
type AWSResponse SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

newSubscribeToShard Source #

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.

Constructors

SubscribeToShardResponse' 

Fields

Instances

Instances details
Generic SubscribeToShardResponse Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Associated Types

type Rep SubscribeToShardResponse :: Type -> Type #

NFData SubscribeToShardResponse Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

type Rep SubscribeToShardResponse Source # 
Instance details

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 #

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_eventStream :: Lens' SubscribeToShardResponse Value Source #

The event stream that your consumer can use to read records from the shard.