Esempio 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)
		}
	}
}
Esempio n. 2
0
func (m bsMarshaler) UnmarshalPayload(msg tmsg.Message) error {
	msg.SetBody(map[string]string{
		"1": "2",
	})
	return nil
}
Esempio n. 3
0
func (m bsMarshaler) MarshalBody(msg tmsg.Message) error {
	msg.SetPayload([]byte("total garbage"))
	return nil
}