20 lines
393 B
Go
20 lines
393 B
Go
|
|
package orchestration
|
||
|
|
|
||
|
|
import "yakpanel/control-plane-go/pkg/contracts"
|
||
|
|
|
||
|
|
type Queue interface {
|
||
|
|
Publish(topic string, payload any) error
|
||
|
|
}
|
||
|
|
|
||
|
|
type Dispatcher struct {
|
||
|
|
queue Queue
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewDispatcher(queue Queue) *Dispatcher {
|
||
|
|
return &Dispatcher{queue: queue}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (d *Dispatcher) DispatchCommand(cmd contracts.CommandEnvelope) error {
|
||
|
|
return d.queue.Publish("yakpanel.commands", cmd)
|
||
|
|
}
|