new changes
This commit is contained in:
19
control-plane-go/internal/orchestration/dispatcher.go
Normal file
19
control-plane-go/internal/orchestration/dispatcher.go
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user