示例#1
0
文件: iron.go 项目: bg451/iron-maiden
func (ir *IronRunner) setupQueues(queues []string) {
	qs, err := mq.List()
	for _, q := range qs {
		log.Println("[INFO] deleting queues")
		err = q.Delete()
		if err != nil {
			log.Println("delete err", err)
		}
	}
	for _, q := range queues {
		_, err := mq.CreateQueue(q, mq.QueueInfo{})
		if err != nil {
			log.Println("err", err)
		}
	}
}
示例#2
0
// CreateIronQueue creates and returns Iron.io queue
func CreateIronQueue(name string) (*mq.Queue, error) {
	subscribers := []mq.QueueSubscriber{}
	subscription := mq.PushInfo{
		Retries:      3,
		RetriesDelay: 60,
		ErrorQueue:   "error_queue",
		Subscribers:  subscribers,
	}
	queue_type := "push"
	queueInfo := mq.QueueInfo{Type: queue_type, MessageExpiration: 60, MessageTimeout: 56, Push: &subscription}
	_, err := mq.CreateQueue(name, queueInfo)
	if err != nil {
		return nil, err
	}

	queue := mq.New(name)
	return &queue, nil
}