Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.0 #19

Merged
merged 5 commits into from
Jan 5, 2025
Merged

1.1.0 #19

merged 5 commits into from
Jan 5, 2025

Conversation

inaiat
Copy link
Owner

@inaiat inaiat commented Jan 5, 2025

Automatically unsubscribe on shutdown_consumer to ensure cleanup

Description

This PR enhances the Kafka consumer cleanup process by automatically unsubscribing from topics when shutting down the consumer and changes the return type of recv() method in JavaScript.

Changes

  • Added automatic unsubscribe call in shutdown_consumer method
  • Updated logging messages to be more descriptive about the shutdown process
  • Ensure shutdown signal is sent after unsubscribing
  • Changed recv() method return type to be more TypeScript friendly

Testing

  • Test consumer shutdown process
  • Verify no hanging connections after shutdown
  • Test resubscribing with a new consumer instance
  • Test recv() method returns null on shutdown
  • Test TypeScript type definitions

Breaking Changes

Yes. This includes a breaking change in the JavaScript/TypeScript API:

Before:

// Old return type
recv(): Promise<Message>

After:

// New return type
recv(): Promise<Message | null>

Consumers will need to update their null checks from:

const msg = await consumer.recv();
if (msg === null) {
  // handle no message (after call shutdownConsumer method)
}

@inaiat inaiat merged commit 5a0bbd3 into main Jan 5, 2025
8 checks passed
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.

1 participant