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?

posta un anno fa288 visualizzazioni
1 Risposta
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
TECNICO DI SUPPORTO
Rajat_C
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande