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?

preguntada hace un año288 visualizaciones
1 Respuesta
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
INGENIERO DE SOPORTE
Rajat_C
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas