Skip to content

Add error handling for SubscribeTopics function call in consumer_example.go #1167

Open
@Vrashabh-Sontakke

Description

@Vrashabh-Sontakke

Description

Currently, the consumer_example.go file lacks error handling for the SubscribeTopics function call. This makes the application vulnerable to potential failures during topic subscription. To ensure robustness and proper error handling, we need to add error checking and handling for this function call.

err = c.SubscribeTopics(topics, nil)

How to reproduce

N/A

Proposed Solution

====================

Add error handling logic after the SubscribeTopics function call in the main function of consumer_example.go. Specifically, check for errors returned by the function call and exit the program with an error message if subscription fails.

Additional Information

This issue is critical for ensuring the reliability of the Kafka consumer application. Proper error handling during topic subscription is essential for smooth operation in production environments.

Checklist

Please provide the following information:

  • confluent-kafka-go and librdkafka version (LibraryVersion()):
  • Apache Kafka broker version:
  • Client configuration: ConfigMap{...}
  • Operating system:
  • Provide client logs (with "debug": ".." as necessary)
  • Provide broker log excerpts
  • Critical issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions