Documentation
¶
Index ¶
- func GenerateID(eventType string) string
- func NewError(msg string) error
- type Event
- type EventBus
- func (eb *EventBus) DeliverResponse(originalEvent Event, responseData interface{}, err error)
- func (eb *EventBus) Publish(eventType string, data interface{}, metadata ...map[string]interface{}) string
- func (eb *EventBus) PublishEvent(event Event)
- func (eb *EventBus) PublishMultiple(eventTypes []string, data interface{}, metadata ...map[string]interface{}) []string
- func (eb *EventBus) RequestMultiple(ctx context.Context, requestTypes []string, data interface{}, ...) (map[string]interface{}, []error)
- func (eb *EventBus) RequestReply(ctx context.Context, requestType string, data interface{}, ...) (interface{}, error)
- func (eb *EventBus) Subscribe(pattern string, bufferSize int) (<-chan Event, func())
- func (eb *EventBus) SubscribeWithFilter(pattern string, bufferSize int, filter FilterFunc) (<-chan Event, func())
- type FilterFunc
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
Types ¶
type Event ¶
type Event struct {
ID string // Unique event identifier
Type string // Event type
CorrelationID string // ID for related events (e.g., request-response)
ReplyTo string // Topic for response event (optional)
Data interface{} // Event payload
Timestamp time.Time // Event creation timestamp
Metadata map[string]interface{} // Additional metadata
}
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
func NewEventBus ¶
func (*EventBus) DeliverResponse ¶
func (*EventBus) PublishEvent ¶
func (*EventBus) PublishMultiple ¶
func (*EventBus) RequestMultiple ¶
func (eb *EventBus) RequestMultiple(ctx context.Context, requestTypes []string, data interface{}, timeout time.Duration) (map[string]interface{}, []error)
RequestMultiple sends a request to multiple recipients and collects responses
func (*EventBus) RequestReply ¶
func (*EventBus) SubscribeWithFilter ¶
func (eb *EventBus) SubscribeWithFilter(pattern string, bufferSize int, filter FilterFunc) (<-chan Event, func())
type FilterFunc ¶
type Subscription ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
|
|
|
parallel_multiple_requests
command
|
|
|
patterns
command
|
|
|
publishing_multiple_topics
command
|
|
|
request-reply
command
|
|
Click to show internal directories.
Click to hide internal directories.