Skip to content
New issue

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

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

Already on GitHub? # to your account

Change the producers to return errors instead of failing and causing the process to exit #191

Open
lburgazzoli opened this issue Aug 24, 2024 · 0 comments

Comments

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Aug 24, 2024

The current pattern to handle errors in producers is:

if err != nil {
    log.Fatal().Err(err).Msg("...")
 }

This causes to the os.Exit(1) function to be called.
In the light of better modularization/plugins, producers should return a proper error to let the caller a chance to handle it.

This means that the current Producer interface should be amended to become:

type Producer interface {
	Produce(ctx context.Context, k []byte, v []byte, o any) error
        Close(ctx context.Context) error
}

Relates to #163

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant