Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPayloadTypeMismatch = errors.New("Mismatch parameter between subscriber and event payload")
ErrPayloadTypeMismatch indicates if the payload type between subscriber and event not match
var ErrSubscriberInvalidFirstParameter = errors.New("Subscriber should have `context.Context` as the first parameter")
ErrSubscriberInvalidFirstParameter indicates if the subscriber's first parameter should be context.Context
var ErrSubscriberInvalidFirstReturnType = errors.New("Subscriber should have return type `error`")
ErrSubscriberInvalidFirstReturnType indicates if the subscriber's return type should be error
var ErrSubscriberInvalidParameters = errors.New("Subscriber should have exactly 2 parameters")
ErrSubscriberInvalidParameters indicates if the subscriber doesn't have 2 parameters
var ErrSubscriberInvalidReturnTypes = errors.New("Subscriber should have 1 return type")
ErrSubscriberInvalidReturnTypes indicates if the subscriber should only have 1 return type
var ErrSubscriberNotAFunction = errors.New("Subscriber should be a function")
ErrSubscriberNotAFunction indicates if the subscriber is not a function
Functions ¶
This section is empty.
Types ¶
type SubscriberConfigFunc ¶ added in v1.3.0
type SubscriberConfigFunc func(*subscriberConfig)
SubscriberConfigFunc is signature of function for doing configuration
func DelayRetry ¶
func DelayRetry(delay time.Duration) SubscriberConfigFunc
DelayRetry configures delay between each retry
func OnError ¶
func OnError(onError func(error)) SubscriberConfigFunc
OnError specify what to do when error occured
func OnSuccess ¶ added in v1.1.0
func OnSuccess(onSuccess func()) SubscriberConfigFunc
OnSuccess specify what to do when no error occured
func Retry ¶
func Retry(count int) SubscriberConfigFunc
Retry configures how many times should the subscriber retries before really failing
type Topic ¶ added in v1.2.0
type Topic[Payload any] interface { Publish(context.Context, Payload) error Subscribe(sub Subscriber[Payload], configurators ...SubscriberConfigFunc) }