mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 05:54:08 +01:00
29 lines
462 B
Go
29 lines
462 B
Go
package domain
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
type Event struct {
|
|
ID string
|
|
Type string
|
|
Source string
|
|
Timestamp time.Time
|
|
Payload interface{}
|
|
AggregateID string
|
|
}
|
|
|
|
type EventPublisher interface {
|
|
Publish(ctx context.Context, event Event) error
|
|
}
|
|
|
|
type EventSubscriber interface {
|
|
Subscribe(ctx context.Context, eventType string, handler func(Event) error) error
|
|
}
|
|
|
|
type EventBus interface {
|
|
EventPublisher
|
|
EventSubscriber
|
|
}
|