Ejemplo n.º 1
0
func (t *rabbitTransport) deliveryToMessage(delivery amqp.Delivery, msg message.Message) {
	msg.SetId(delivery.CorrelationId)
	msg.SetHeaders(tableToHeaders(delivery.Headers))
	msg.SetHeader("X-Rabbit-ReplyTo", delivery.ReplyTo)
	msg.SetPayload(delivery.Body)
	if req, ok := msg.(message.Request); ok {
		switch service := delivery.Headers["Service"].(type) {
		case string:
			req.SetService(service)
		}
		switch endpoint := delivery.Headers["Endpoint"].(type) {
		case string:
			req.SetEndpoint(endpoint)
		}
	}
}
Ejemplo n.º 2
0
func (m bsMarshaler) MarshalBody(msg tmsg.Message) error {
	msg.SetPayload([]byte("total garbage"))
	return nil
}