예제 #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
}
예제 #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
}
예제 #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
}
예제 #4
0
func main() {
	consumer.Register("crawl", "queue", 2500, HandleCrawl)
	consumer.ConnectToLookupd(lookupdAddr)
	consumer.Start(true) // starts to wait
}
예제 #5
0
func main() {
	flag.Parse()
	consumer.Register("latency-test", "consume", *maxInFlight, HandleTest)
	consumer.Connect(*nsqdAddr)
	consumer.Start(true)
}