Flamenco/internal/manager/eventbus/events_lifecycle.go
Sybren A. Stüvel 12bfa82854 Manager: add lifecycle events to the event bus
Send events on Manager startup & shutdown. To make this possible, events
sent to MQTT are now queued up until an MQTT server can be reached.
Otherwise the startup event would be sent before the MQTT connection was
established.
2024-02-21 22:20:56 +01:00

21 lines
500 B
Go

package eventbus
// SPDX-License-Identifier: GPL-3.0-or-later
import (
"github.com/rs/zerolog/log"
"projects.blender.org/studio/flamenco/pkg/api"
)
func NewLifeCycleEvent(lifeCycleType api.LifeCycleEventType) api.EventLifeCycle {
event := api.EventLifeCycle{
Type: lifeCycleType,
}
return event
}
func (b *Broker) BroadcastLifeCycleEvent(event api.EventLifeCycle) {
log.Debug().Interface("event", event).Msg("eventbus: broadcasting lifecycle event")
b.broadcast(TopicLifeCycle, event)
}