Beispiel #1
0
// Open starts the service
func (s *Service) Open() error {
	go func() error {
		log.Info("starting dockerd service")
		if err := nsq.Register(TOPIC, "engine", maxInFlight, s.processNSQ); err != nil {
			return err
		}
		if err := nsq.Connect(s.Meta.NSQd...); err != nil {
			return err
		}
		s.Consumer = nsq.DefaultConsumer

		nsq.Start(true)
		return nil
	}()
	if err := s.setProvisioner(provision.PROVIDER_DOCKER); err != nil {
		return err
	}
	return nil
}
Beispiel #2
0
// Open starts the service
func (s *Service) Open() error {
	if err := s.setEventsWrap(s.Eventsd); err != nil {
		return err
	}
	go func() error {
		log.Info("starting eventsd service")
		if err := nsq.Register(TOPIC, "engine", maxInFlight, s.processNSQ); err != nil {
			return err
		}
		if err := nsq.Connect(s.Meta.NSQd...); err != nil {
			return err
		}

		s.Consumer = nsq.DefaultConsumer

		nsq.Start(true)
		return nil
	}()
	return nil
}
Beispiel #3
0
// Open starts the service
func (s *Service) Open() error {
	if err := s.setEventsWrap(); err != nil {
		return err
	}
	go func() error {
		log.Info("starting deployd agent service")
		if err := nsqc.Register(s.Meta.Name, "agent", maxInFlight, s.processNSQ); err != nil {
			return err
		}
		if err := nsqc.Connect(s.Meta.NSQd...); err != nil {
			return err
		}
		s.Consumer = nsqc.DefaultConsumer

		nsqc.Start(true)
		return nil
	}()
	if err := s.setProvisioner(); err != nil {
		return err
	}
	s.boot()
	return nil
}
Beispiel #4
0
func main() {
	consumer.Register("crawl", "queue", 2500, HandleCrawl)
	consumer.ConnectToLookupd(lookupdAddr)
	consumer.Start(true) // starts to wait
}
Beispiel #5
0
func main() {
	flag.Parse()
	consumer.Register("latency-test", "consume", *maxInFlight, HandleTest)
	consumer.Connect(*nsqdAddr)
	consumer.Start(true)
}