Skip to content

Improve Data Stream Cleanup and Management with Enhanced Tracking and Sequential IDs#111

Open
Andreufb wants to merge 4 commits intomainfrom
data_stream_clearing
Open

Improve Data Stream Cleanup and Management with Enhanced Tracking and Sequential IDs#111
Andreufb wants to merge 4 commits intomainfrom
data_stream_clearing

Conversation

@Andreufb
Copy link
Collaborator

This merge introduces significant enhancements to the data stream management and cleanup process, ensuring efficient resource utilization and better user control. Key changes include:

  • Active Consumers and Data Streams Tracking:

    • Implemented active consumers and data streams trackers to manage and clean up resources upon API shutdown.
    • This ensures no leftover streams or consumers remain active after shutdown.
  • Sequential Integer-Based Stream IDs:

    • Replaced random hash-based stream IDs with sequential integers (e.g., data_stream_1, data_stream_2).
    • This allows for clearer identification and better tracking of streams, while also preventing random ID generation.
  • Enforced Maximum Stream Limit:

    • Introduced logic to enforce a maximum number of active streams using an environment variable (KAFKA_MAX_STREAMS).
    • This ensures no more streams than allowed are created, preventing overloading the system.
  • New Endpoint for Stream Deletion:

    • Added an endpoint to delete streams by their integer ID (e.g., 1, 2) or by full topic name.
    • The endpoint efficiently removes streams from Kafka and updates internal trackers.
  • Stream ID Reuse Mechanism:

    • Developed functionality to detect and reuse available stream IDs when streams are deleted.
    • This avoids ID exhaustion and allows for efficient recycling of IDs for newly created streams.
  • Enhanced Kafka Topic Deletion:

    • Improved the Kafka topic deletion process to handle errors gracefully and remove deleted topics from both Kafka and internal trackers.
    • Logging and error handling ensure better transparency and easier debugging for users when topics fail to delete.

These improvements streamline the data stream lifecycle, offering efficient resource management, reducing the potential for stream ID exhaustion, and providing greater control over stream creation and deletion processes.

…s, column value assignation with matematical alues, IN logic, string comaprison logic, value assignation in IF THEN ELSE conditions
…se value handeling for when we dont have enough data.
…opics funcitonality to clear allt he created data streams on closing.
- Ensure unique topics are deleted without duplicates.
- Gracefully handle Kafka-specific exceptions like 'UNKNOWN_TOPIC_OR_PART' to avoid unnecessary errors.
- Added proper logging for successful deletions and warnings for topics that don't exist.
- Cleaned up created_streams list after successful deletion.
@Andreufb Andreufb requested a review from rbardaji October 24, 2024 20:35
@Andreufb Andreufb self-assigned this Oct 24, 2024
@Andreufb
Copy link
Collaborator Author

The .env_kafka has been updated, need to accept this new version.

KAFKA_PREFIX=data_stream
KAFKA_PORT=9092
KAFKA_HOST=155.101.6.194 No newline at end of file
KAFKA_HOST=155.101.6.194
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the IP please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants