subscriber

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 3 Imported by: 0

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

func WithEventTypes(types []bus.EventType) Option

WithEventTypes sets the event types to subscribe to.

func WithLogger

func WithLogger(logger Logger) Option

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

func (s *WebhookEventSubscriber) Handle(ctx context.Context, event bus.Event) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL