Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer binds a durable JetStream pull consumer on the catalog events stream and applies volume.updated events to library entries. It runs as a background worker of the API process and is also startable standalone via cmd/consumer.
func New ¶
func New(handler EventHandler) *Consumer
type EventEnvelope ¶
type EventEnvelope struct {
EventID string `json:"event_id"`
OccurredAt string `json:"occurred_at"`
Source string `json:"source"`
EntityType string `json:"entity_type"`
EntityID string `json:"entity_id"`
Action string `json:"action"`
Revision int `json:"revision"`
Data map[string]interface{} `json:"data"`
}
EventEnvelope is the platform event contract (see sweetrpg/platform docs/messaging-nats.md). Unknown fields are ignored so the envelope can grow without breaking this consumer.
type EventHandler ¶
type EventHandler interface {
HandleVolumeUpdated(ctx context.Context, event *EventEnvelope) error
}
type VolumeEventHandler ¶
type VolumeEventHandler struct {
// contains filtered or unexported fields
}
VolumeEventHandler applies volume.updated events: refresh the denormalized title on every referencing library entry, table volume, and wishlist entry, then drop the affected users' cached list and detail pages.
func NewVolumeEventHandler ¶
func NewVolumeEventHandler(store persistence.CacheStore) *VolumeEventHandler
func (*VolumeEventHandler) HandleVolumeUpdated ¶
func (h *VolumeEventHandler) HandleVolumeUpdated(ctx context.Context, event *EventEnvelope) error
Click to show internal directories.
Click to hide internal directories.