Skip to content

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

Description

@lburgazzoli

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

Activity

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

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