Registers a consumer with a Kinesis data stream. When you use this operation, the consumer you register can then call SubscribeToShard to receive data from the stream using enhanced fan-out, at a rate of up to 2 MiB per second for every shard you subscribe to. This rate is unaffected by the total number of consumers that read from the same stream.
You can add tags to the registered consumer when making a RegisterStreamConsumer request by setting the Tags parameter. If you pass the Tags parameter, in addition to having the kinesis:RegisterStreamConsumer permission, you must also have the kinesis:TagResource permission for the consumer that will be registered. Tags will take effect from the CREATING status of the consumer.
With On-demand Advantage streams, you can register up to 50 consumers per stream to use Enhanced Fan-out. With On-demand Standard and Provisioned streams, you can register up to 20 consumers per stream to use Enhanced Fan-out. A given consumer can only be registered with one stream at a time.
For an example of how to use this operation, see Enhanced Fan-Out Using the Kinesis Data Streams API.
The use of this operation has a limit of five transactions per second per account. Also, only 5 consumers can be created simultaneously. In other words, you cannot have more than 5 consumers in a CREATING status at the same time. Registering a 6th consumer while there are 5 in a CREATING status results in a LimitExceededException.
Parameters:
-
stream_arn
(StreamARN)
–
-
consumer_name
(ConsumerName)
–
For a given Kinesis data stream, each consumer must have a unique name. However, consumer names don't have to be unique across data streams.
-
stream_id
(Optional[StreamId], default:
None
)
–
Not Implemented. Reserved for future use.
-
tags
(Optional[TagMap], default:
None
)
–
A set of up to 50 key-value pairs. A tag consists of a required key and an optional value.
Raises:
-
InvalidArgumentException
–
A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.
-
LimitExceededException
–
The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.
-
ResourceInUseException
–
The resource is not available for this operation. For successful operation, the resource must be in the ACTIVE state.
-
ResourceNotFoundException
–
The requested resource could not be found. The stream might not be specified correctly.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_kinesis/_services/kinesis.py
| def register_stream_consumer(
self,
stream_arn: "capo_kinesis.types.stream_arn.StreamARN",
consumer_name: "capo_kinesis.types.consumer_name.ConsumerName",
*,
config_overrides: Optional[KinesisClientConfig] = None,
stream_id: Optional["capo_kinesis.types.stream_id.StreamId"] = None,
tags: Optional["capo_kinesis.types.tag_map.TagMap"] = None,
) -> "capo_kinesis.types.register_stream_consumer_output.RegisterStreamConsumerOutput":
"""<p>Registers a consumer with a Kinesis data stream. When you use this operation, the consumer you register can then call <a>SubscribeToShard</a> to receive data from the stream using enhanced fan-out, at a rate of up to 2 MiB per second for every shard you subscribe to. This rate is unaffected by the total number of consumers that read from the same stream.</p> <p>You can add tags to the registered consumer when making a <code>RegisterStreamConsumer</code> request by setting the <code>Tags</code> parameter. If you pass the <code>Tags</code> parameter, in addition to having the <code>kinesis:RegisterStreamConsumer</code> permission, you must also have the <code>kinesis:TagResource</code> permission for the consumer that will be registered. Tags will take effect from the <code>CREATING</code> status of the consumer.</p> <p>With On-demand Advantage streams, you can register up to 50 consumers per stream to use Enhanced Fan-out. With On-demand Standard and Provisioned streams, you can register up to 20 consumers per stream to use Enhanced Fan-out. A given consumer can only be registered with one stream at a time.</p> <p>For an example of how to use this operation, see <a href="https://docs.aws.amazon.com/streams/latest/dev/building-enhanced-consumers-api.html">Enhanced Fan-Out Using the Kinesis Data Streams API</a>.</p> <p>The use of this operation has a limit of five transactions per second per account. Also, only 5 consumers can be created simultaneously. In other words, you cannot have more than 5 consumers in a <code>CREATING</code> status at the same time. Registering a 6th consumer while there are 5 in a <code>CREATING</code> status results in a <code>LimitExceededException</code>.</p>
Args:
stream_arn: <p>The ARN of the Kinesis data stream that you want to register the consumer with. For more info, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kinesis-streams">Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces</a>.</p>
consumer_name: <p>For a given Kinesis data stream, each consumer must have a unique name. However, consumer names don't have to be unique across data streams.</p>
stream_id: <p>Not Implemented. Reserved for future use.</p>
tags: <p>A set of up to 50 key-value pairs. A tag consists of a required key and an optional value.</p>
Raises:
capo_kinesis.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.</p>
capo_kinesis.errors.limit_exceeded_exception.LimitExceededException: <p>The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed. </p>
capo_kinesis.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is not available for this operation. For successful operation, the resource must be in the <code>ACTIVE</code> state.</p>
capo_kinesis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found. The stream might not be specified correctly.</p>
capo_kinesis.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_kinesis.types.register_stream_consumer_input.RegisterStreamConsumerInput]",
) -> OperationResponse[
"capo_kinesis.types.register_stream_consumer_output.RegisterStreamConsumerOutput"
]:
import capo_kinesis._operations.kinesis_20131202.register_stream_consumer
output, http_response = (
capo_kinesis._operations.kinesis_20131202.register_stream_consumer.register_stream_consumer(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("RegisterStreamConsumer")
)
input_: capo_kinesis.types.register_stream_consumer_input.RegisterStreamConsumerInput = {
"stream_arn": stream_arn,
"consumer_name": consumer_name,
}
if stream_id is not None:
input_["stream_id"] = stream_id
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|