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

story(notifications): support apache kafka #55

Closed

Conversation

Zaba505
Copy link
Member

@Zaba505 Zaba505 commented Nov 6, 2022

Closes #24

@Zaba505 Zaba505 added enhancement New feature or request bus notification bus related kafka Apache Kafka labels Nov 6, 2022
@Zaba505 Zaba505 added this to the Prototype milestone Nov 6, 2022
@Zaba505 Zaba505 requested a review from erictg November 6, 2022 03:44
@Zaba505 Zaba505 self-assigned this Nov 6, 2022
@Zaba505 Zaba505 linked an issue Nov 6, 2022 that may be closed by this pull request
3 tasks
Copy link
Member

@erictg erictg left a comment

Choose a reason for hiding this comment

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

move errors into a package level error file


// Bus
type Bus interface {
// Publish
Copy link
Member

Choose a reason for hiding this comment

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

more descriptive comment needed

ErrMissingLogger = errors.New("logger is required")
)

// Bus
Copy link
Member

Choose a reason for hiding this comment

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

more descriptive comment needed

Cause error
}

func (e Error) Error() string {
Copy link
Member

Choose a reason for hiding this comment

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

need comment for exported function

return fmt.Sprintf("%s: encountered unexpected error: %s", e.Bus, e.Cause)
}

func (e Error) Unwrap() error {
Copy link
Member

Choose a reason for hiding this comment

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

need comment for exported function

Cause error
}

func (e MarshalError) Error() string {
Copy link
Member

Choose a reason for hiding this comment

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

need comment for exported function

}

var (
ErrMissingKafkaAddrs = errors.New("kafka addresses are required")
Copy link
Member

Choose a reason for hiding this comment

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

need comment for exported value

Comment on lines 52 to 55
panic(ConfigurationError{
Bus: kafkaBus,
Cause: err,
})
Copy link
Member

Choose a reason for hiding this comment

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

panic bad, return an error instead of panicking

return nil
}

// Publish
Copy link
Member

Choose a reason for hiding this comment

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

need more descriptive comment

type KafkaConfig struct {
Addresses []string
AllowAutoTopicCreation bool
Logger *zap.Logger
Copy link
Member

Choose a reason for hiding this comment

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

why provide the logger via the config. Wouldn't it be better to use the global zap for consistency and just add required fields for kafka?

Copy link
Member Author

Choose a reason for hiding this comment

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

Global state should always be avoided. Only the cmd package is using the global logger and that's simply cuz I haven't updated it yet to not use the global one.

Comment on lines +39 to +40
Addresses []string
AllowAutoTopicCreation bool
Copy link
Member

Choose a reason for hiding this comment

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

add validator tags and use the validator for this

@Zaba505
Copy link
Member Author

Zaba505 commented Feb 10, 2023

No longer going this route

@Zaba505 Zaba505 closed this Feb 10, 2023
@Zaba505 Zaba505 deleted the story/notifications/issue-24-support-apache-kafka branch February 10, 2023 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bus notification bus related enhancement New feature or request kafka Apache Kafka
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

story(notifications): support apache kafka
2 participants