Documentation
¶
Overview ¶
Package subscriber provides event bus integration for webhooks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Info(msg string, args ...any)
Error(msg string, args ...any)
Debug(msg string, args ...any)
Warn(msg string, args ...any)
}
Logger defines the logging interface for the subscriber.
type Option ¶
type Option func(*WebhookEventSubscriber)
Option configures the WebhookEventSubscriber.
func WithEventTypes ¶
WithEventTypes sets the event types to subscribe to.
func WithLogger ¶
WithLogger sets the logger for the subscriber.
type WebhookEventSubscriber ¶
type WebhookEventSubscriber struct {
// contains filtered or unexported fields
}
WebhookEventSubscriber listens to events and triggers webhook deliveries.
func NewWebhookEventSubscriber ¶
func NewWebhookEventSubscriber(svc *service.WebhookService, opts ...Option) *WebhookEventSubscriber
NewWebhookEventSubscriber creates a new webhook event subscriber. By default, it subscribes to common workflow and job events.
func (*WebhookEventSubscriber) Handle ¶
Handle processes an event and delivers it to subscribed webhooks.
func (*WebhookEventSubscriber) RegisterWithBus ¶
func (s *WebhookEventSubscriber) RegisterWithBus(eventBus *bus.EventBus)
RegisterWithBus subscribes this handler to all its event types on the bus.
func (*WebhookEventSubscriber) SubscribedEvents ¶
func (s *WebhookEventSubscriber) SubscribedEvents() []bus.EventType
SubscribedEvents returns the event types this subscriber handles.
func (*WebhookEventSubscriber) UnregisterFromBus ¶
func (s *WebhookEventSubscriber) UnregisterFromBus(eventBus *bus.EventBus)
UnregisterFromBus removes this handler from all its event types on the bus.