Sybren A. Stüvel
12bfa82854
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.
21 lines
500 B
Go
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)
|
|
}
|