func (bs *BaseService) startBusServer() (err error) { if bs.running { return errors.New("Can not start a service twice") } if !bs.config.Valid { return errors.New("Config is not valid") } err = bs.checkIfRequestsAllAvailabe() if err != nil { return } var selfServer bus.ServerConfig selfServer.Type = bs.config.Server.Type selfServer.ServerId = bs.config.Server.Id selfServer.Host = bs.config.Server.Host selfServer.Port = bs.config.Server.Port selfServer.Name = bs.config.Server.Name selfServer.Network = bs.config.Server.Network bs.busServer, err = bus.StartBusServer(&selfServer) if err != nil { panic(err.Error()) } log.Debugf("startBusServer:busServer(%+v)\n", *bs.busServer) return }
func (bs *BaseService) startBusStub() (err error) { if bs.running { return errors.New("Can not start a service twice") } if !bs.config.Valid { return errors.New("Config is not valid") } err = bs.checkIfRequestsAllAvailabe() if err != nil { return } var selfServer bus.ServerConfig selfServer.Type = bs.config.Server.Type selfServer.ServerId = bs.config.Server.Id selfServer.Host = bs.config.Server.Host selfServer.Port = bs.config.Server.Port selfServer.Name = bs.config.Server.Name selfServer.Network = bs.config.Server.Network selfServer.Requests = bs.config.Server.Requests var busServer bus.ServerConfig busServer.Type = bs.config.Connector.Type busServer.ServerId = bs.config.Connector.Id busServer.Host = bs.config.Connector.Host busServer.Port = bs.config.Connector.Port busServer.Name = bs.config.Connector.Name busServer.Network = bs.config.Connector.Network bs.busStub, err = bus.StartBusStub(&selfServer, &busServer) if err != nil { return } log.Debugf("startBusStub:busStub(%+v)\n", *bs.busStub) return }