func()

in queue_manager.go [183:216]


func (p *MNSQueueManager) CreateQueueWithOptions(queueName string, options ...QueueOption) (err error) {
	queueName = strings.TrimSpace(queueName)
	if err = checkQueueName(queueName); err != nil {
		return
	}
	opts := defaultQueueOptions()
	tracker := make(map[string]bool)
	for _, opt := range options {
		opt(&opts, tracker)
	}

	if err = checkAttributes(opts.delaySeconds, opts.messageRetentionPeriod,
		opts.visibilityTimeout, opts.pollingWaitSeconds); err != nil {
		return
	}

	message := CreateQueueRequest{
		DelaySeconds:           opts.delaySeconds,
		MaxMessageSize:         opts.maxMessageSize,
		MessageRetentionPeriod: opts.messageRetentionPeriod,
		VisibilityTimeout:      opts.visibilityTimeout,
		PollingWaitSeconds:     opts.pollingWaitSeconds,
		LoggingEnabled:         opts.loggingEnabled,
	}

	var code int
	code, err = send(p.cli, p.decoder, PUT, nil, &message, "queues/"+queueName, nil)
	if code == http.StatusNoContent {
		err = ERR_MNS_QUEUE_ALREADY_EXIST_AND_HAVE_SAME_ATTR.New(errors.Params{"name": queueName})
		return
	}

	return
}