Delete a consumer group

Updated at:

Call DeleteConsumerGroup to delete a specified consumer group.

Prerequisites

Parameters

def delete_consumer_group(self, project, logstore, consumer_group):

Request parameters

Parameter

Type

Required

Description

project

String

Yes

The name of the Project.

logstore

String

Yes

The name of the Logstore.

consumer_group

String

Yes

The name of the consumer group to delete.

Response parameters

See DeleteConsumerGroup.

Examples

from aliyun.log import LogClient
import os


def main():
    # This example retrieves the AccessKey ID and AccessKey Secret from environment variables.
    access_key_id = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
    access_key_secret = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
    # The endpoint for Log Service. This example uses the endpoint for the China (Hangzhou) region.
    endpoint = "cn-hangzhou.log.aliyuncs.com"

    client = LogClient(endpoint, access_key_id, access_key_secret)

    project = "ali-test-project"
    logstore = "test-logstore"
    consumer_group = "consumer_group_test"

    try:
        response = client.delete_consumer_group(project, logstore, consumer_group)
        response.log_print()
    except Exception as e:
        print(f"An error occurred while deleting the consumer group: {e}")


if __name__ == '__main__':
    main()