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