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?

질문됨 일 년 전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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠