Пример #1
0
func NewPQContext(pq *PQueue, r apis.ResponseWriter) *PQContext {
	return &PQContext{
		pq:             pq,
		callsCount:     0,
		responseWriter: r,
		asyncCount:     512,
		idGen:          idgen.NewGen(),
	}
}
Пример #2
0
	switch paramName {
	case "DelaySeconds":
		mp.DelaySeconds, err = strconv.ParseInt(value, 10, 0)
		mp.DelaySeconds *= 1000
	case "MessageBody":
		mp.MessageBody = value
	}

	if err != nil {
		return sqserr.MalformedInputError("Invalid value for the parameter " + paramName)
	}

	return nil
}

var IdGen = idgen.NewGen()

func PushAMessage(pq *pqueue.PQueue, senderId string, paramList []string) sqs_response.SQSResponse {
	out := &MessageParams{
		DelaySeconds: -1,
		MessageBody:  "",
	}
	attrs, err := urlutils.ParseNNotationAttr("MessageAttribute.", paramList, out.Parse, NewReqQueueAttr)
	if err != nil {
		return err
	}
	attrsLen := len(attrs)
	outAttrs := make(map[string]*sqsmsg.UserAttribute)

	for i := 1; i <= attrsLen; i++ {
		a, ok := attrs[i]