Exemple #1
0
func (t *rabbitTransport) handleReqDelivery(delivery amqp.Delivery, reqChan chan<- message.Request) {
	logId := t.logId(delivery)
	enc := delivery.Headers["Content-Encoding"].(string)
	switch enc {
	case "request":
		req := message.NewRequest()
		t.deliveryToMessage(delivery, req)

		timeout := time.NewTimer(chanSendTimeout)
		defer timeout.Stop()
		select {
		case reqChan <- req:
		case <-timeout.C:
			log.Errorf("[Typhon:RabbitTransport] Could not deliver request %s after %s: receiving channel is full",
				logId, chanSendTimeout.String())
		}

	default:
		log.Debugf("[Typhon:RabbitTransport] Cannot handle Content-Encoding \"%s\" as request for %s", enc, logId)
	}
}
Exemple #2
0
func NewRequest() Request {
	return FromTyphonRequest(tmsg.NewRequest())
}