-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
notification/kafka.go
Outdated
panic(ConfigurationError{ | ||
Bus: kafkaBus, | ||
Cause: err, | ||
}) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Addresses []string | ||
AllowAutoTopicCreation bool |
There was a problem hiding this comment.
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
No longer going this route |
Closes #24