Use DeregisterStreamConsumer
with an Amazon SDK or CLI
The following code examples show how to use DeregisterStreamConsumer
.
- .NET
-
- Amazon SDK for .NET
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. using System; using System.Threading.Tasks; using Amazon.Kinesis; using Amazon.Kinesis.Model; /// <summary> /// Shows how to deregister a consumer from an Amazon Kinesis stream. /// </summary> public class DeregisterConsumer { public static async Task Main(string[] args) { IAmazonKinesis client = new AmazonKinesisClient(); string streamARN = "arn:aws:kinesis:us-west-2:000000000000:stream/AmazonKinesisStream"; string consumerName = "CONSUMER_NAME"; string consumerARN = "arn:aws:kinesis:us-west-2:000000000000:stream/AmazonKinesisStream/consumer/CONSUMER_NAME:000000000000"; var success = await DeregisterConsumerAsync(client, streamARN, consumerARN, consumerName); if (success) { Console.WriteLine($"{consumerName} successfully deregistered."); } else { Console.WriteLine($"{consumerName} was not successfully deregistered."); } } /// <summary> /// Deregisters a consumer from a Kinesis stream. /// </summary> /// <param name="client">An initialized Kinesis client object.</param> /// <param name="streamARN">The ARN of a Kinesis stream.</param> /// <param name="consumerARN">The ARN of the consumer.</param> /// <param name="consumerName">The name of the consumer.</param> /// <returns>A Boolean value representing the success of the operation.</returns> public static async Task<bool> DeregisterConsumerAsync( IAmazonKinesis client, string streamARN, string consumerARN, string consumerName) { var request = new DeregisterStreamConsumerRequest { StreamARN = streamARN, ConsumerARN = consumerARN, ConsumerName = consumerName, }; var response = await client.DeregisterStreamConsumerAsync(request); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; } }
-
For API details, see DeregisterStreamConsumer in Amazon SDK for .NET API Reference.
-
- CLI
-
- Amazon CLI
-
To deregister a data stream consumer
The following
deregister-stream-consumer
example deregisters the specified consumer from the specified data stream.aws kinesis deregister-stream-consumer \ --stream-arn
arn:aws:kinesis:us-west-2:123456789012:stream/samplestream
\ --consumer-nameKinesisConsumerApplication
This command produces no output.
For more information, see Developing Consumers with Enhanced Fan-Out Using the Kinesis Data Streams API
in the Amazon Kinesis Data Streams Developer Guide. -
For API details, see DeregisterStreamConsumer
in Amazon CLI Command Reference.
-
For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.