// Marshal marshals a message.
Marshal marshals a message.
// Marshal marshals a message .
func (d DefaultMarshaler) Marshal(msg *message.Message) (amqp.Publishing, error) {
	headers := make(amqp.Table, len(msg.Metadata)+1) 
	for key, value := range msg.Metadata {
		logger.Debugf("Metadata [%s]: %s", key, value)
		if key == metadataExpiration {
			logger.Debugf("Ignoring metadata [%s] since it will be set in the message directly", key)
			continue
		}
		headerValue, err := unmarshalHeaderValue(value)
		if err != nil {
			return amqp.Publishing{}, fmt.Errorf("unmarshal value for metadata %s: %w", key, err)
		}
		headers[key] = headerValue
	}
	headers[d.computeMessageUUIDHeaderKey()] = msg.UUID
	publishing := amqp.Publishing{
		Body:       msg.Payload,
		Headers:    headers,
		Expiration: getExpiration(msg.Metadata),
	}
	if !d.NotPersistentDeliveryMode {
		publishing.DeliveryMode = amqp.Persistent
	}
	if d.PostprocessPublishing != nil {
		publishing = d.PostprocessPublishing(publishing)
	}
	return publishing, nil
}
func ( d DefaultMarshaler ) Marshal ( msg * message . Message ) ( amqp . Publishing , error ) { headers := make ( amqp . Table , len ( msg . Metadata ) + 1 ) for key , value := range msg . Metadata { logger . Debugf ( " " , key , value ) if key == metadataExpiration { logger . Debugf ( " " , key ) continue } headerValue , err := unmarshalHeaderValue ( value ) if err != nil { return amqp . Publishing { } , fmt . Errorf ( " " , key , err ) } headers [ key ] = headerValue } headers [ d . computeMessageUUIDHeaderKey ( ) ] = msg . UUID publishing := amqp . Publishing { Body : msg . Payload , Headers : headers , Expiration : getExpiration ( msg . Metadata ) , } if ! d . NotPersistentDeliveryMode { publishing . DeliveryMode = amqp . Persistent } if d . PostprocessPublishing != nil { publishing = d . PostprocessPublishing ( publishing ) } return publishing , nil }
Marshal marshals a message.
Marshal marshals a message .
// metadata + plus uuid