Documentation
¶
Index ¶
Constants ¶
const ( DefaultSubscriberParallelism = 1 DefaultTestParallelism = 1 DefaultShutdownTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is a function that handles a CloudEvent
type Publisher ¶
type Publisher interface {
// Publish publishes a CloudEvent to the specified topic
Publish(topic string, event *event.Event) error
// Close closes the underlying publisher
Close() error
}
Publisher defines the interface for publishing CloudEvents
func NewPublisher ¶
NewPublisher creates a new publisher based on the configuration. If configMap is provided, it will be used instead of loading from file. Providing a configMap is meant to be used for testing purposes only. Config keys should use dot notation (e.g., "broker.type", "broker.rabbitmq.url").
type Subscriber ¶
type Subscriber interface {
// Subscribe subscribes to a topic and processes messages with the provided handler
Subscribe(ctx context.Context, topic string, handler HandlerFunc) error
// Close closes the underlying subscriber
Close() error
}
Subscriber defines the interface for subscribing to CloudEvents
func NewSubscriber ¶
func NewSubscriber(subscriptionID string, configMap ...map[string]string) (Subscriber, error)
NewSubscriber creates a new subscriber based on the configuration. subscriptionID determines whether subscribers share messages (same ID = shared, different IDs = separate). If configMap is provided, it will be used instead of loading from file. Config keys should use dot notation (e.g., "broker.type", "broker.rabbitmq.url").