Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEventHandler ¶
func NewEventHandler[T any](opts ...Option[T]) event.EventHandler[T]
NewEventHandler creates a new event.EventHandler that sends callbacks based on the success or failure of an event.
- This handler supports internal logging; if a custom logger is provided via WithLogger, it will be used; otherwise, it will try to extract a logger from the context, and if none is found, a default logger will be used.
Types ¶
type CallbackEventMessage ¶
type CallbackEventMessage[T any] struct { event.BaseEventMessage[T] Callback *CallbackInfo `json:"callback"` }
func (*CallbackEventMessage[T]) GetCallback ¶
func (m *CallbackEventMessage[T]) GetCallback() *CallbackInfo
type CallbackInfo ¶
type Option ¶
type Option[T any] func(*callbackEventHandler[T])
Option is a function that configures an EventHandler
func WithCallbackConfig ¶
func WithCallbackConfig[T any](maxRetries int, retryInterval, callbackTimeout time.Duration) Option[T]
WithCallbackConfig sets the callback configuration
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client
func WithLogger ¶
func WithLogger[T any](customLogger common_logger.Logger) Option[T]
WithLogger sets a custom logger.Logger implementation for the EventHandler. If not provided, the logger will be extracted from the context or a default will be used.
Click to show internal directories.
Click to hide internal directories.