amazonka-kinesis-2.0: Amazon Kinesis SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 second call takes over the subscription and the previous connection expires or fails with a ResourceInUseException.

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

  • consumerARN :: Text

    For this parameter, use the value you obtained when you called RegisterStreamConsumer.

  • shardId :: Text

    The ID of the shard you want to subscribe to. To see a list of all the shards for a given stream, use ListShards.

  • startingPosition :: StartingPosition

    The starting position in the data stream from which to start streaming.

Instances

Instances details
ToJSON SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.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

AWSRequest SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Associated Types

type AWSResponse SubscribeToShard #

Generic SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Associated Types

type Rep SubscribeToShard :: Type -> Type #

Read SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Show SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

NFData SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Methods

rnf :: SubscribeToShard -> () #

Eq SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

Hashable SubscribeToShard Source # 
Instance details

Defined in Amazonka.Kinesis.SubscribeToShard

type AWSResponse 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" "amazonka-kinesis-2.0-AW1spVPMUGf3LUqQQ22bci" '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))))

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:

SubscribeToShard, subscribeToShard_consumerARN - For this parameter, use the value you obtained when you called RegisterStreamConsumer.

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 - The starting position in the data stream from which to start streaming.

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.

subscribeToShard_startingPosition :: Lens' SubscribeToShard StartingPosition Source #

The starting position in the data stream from which to start streaming.

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" "amazonka-kinesis-2.0-AW1spVPMUGf3LUqQQ22bci" '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.