package link import ( "github.com/novox/mesh-controller/internal/broker" ) // ConnectNats is Connect for the bus being built: the controller's inbound and outbound over one // JetStream connection the caller has already raised the streams on. Nothing is declared here — // the streams and the controller's consumers are asserted by Raise, before anything is served. func ConnectNats(js *broker.JetStream, enroller Enroller, listener Listener) *Server { return &Server{ inbound: Nats(js), bus: OverNATS{JS: js.Context(), Conn: js.Conn()}, js: js, enroller: enroller, listener: listener, log: newLog(), } } // Bus is the controller's outbound, whichever transport it connected over. Callers that send a // declaration or ask a tool use this rather than the channel, which one transport does not have. func (s *Server) Bus() Bus { return s.bus }