registerStreamConsumer, how to get updated consumer status?

0

I have a Java app which is calling KinesisClient.registerStreamConsumer. The response contains a Consumer object. The Consumer.consumerStatus() value remains as "CREATING", even though I can see on AWS Console that it has transitioned to "ACTIVE". How does one poll the consumer object for its current status?

質問済み 1年前288ビュー
1回答
0

Hello,

Your understanding is correct RegisterStreamConsumer API 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[1]

aws kinesis register-stream-consumer --consumer-name con1 --stream-arn arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1

{
    "Consumer": {
        "ConsumerName": "con1",
        "ConsumerARN": "arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1/consumer/con1:1679992900",
        "ConsumerStatus": "CREATING",
        "ConsumerCreationTimestamp": "2023-03-28T14:11:40+05:30"
    }
}

We get ConsumerStatus as CREATING because RegisterStreamConsumer is asynchronous operation which responds with acknowledgment first and registers consumer asynchronously due to which we don't receive the updated status of the consumer.

You can consider using ListStreamConsumers or DescribeStreamConsumer API to check the current status of your consumer as per your use case[2][3]

Sharing example outputs for reference:

aws kinesis list-stream-consumers --stream-arn arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1

{
    "Consumers": [
        {
            "ConsumerName": "con1",
            "ConsumerARN": "arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1/consumer/con1:1679992900",
            "ConsumerStatus": "ACTIVE",
            "ConsumerCreationTimestamp": "2023-03-28T14:11:40+05:30"
        }
    ]
}

aws kinesis describe-stream-consumer --stream-arn arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1 --consumer-name con1

{
    "ConsumerDescription": {
        "ConsumerName": "con1",
        "ConsumerARN": "arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1/consumer/con1:1679992900",
        "ConsumerStatus": "ACTIVE",
        "ConsumerCreationTimestamp": "2023-03-28T14:11:40+05:30",
        "StreamARN": "arn:aws:kinesis:us-east-1:xxxxxxxxx:stream/test1"
    }
}

[1] RegisterStreamConsumer - https://docs.aws.amazon.com/kinesis/latest/APIReference/API_RegisterStreamConsumer.html

[2] ListStreamConsumers - https://docs.aws.amazon.com/kinesis/latest/APIReference/API_ListStreamConsumers.html

[3] DescribeStreamConsumer - https://docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStreamConsumer.html

AWS
サポートエンジニア
Rajat_C
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ