Exemple #1
0
        public TransportMessage ConvertIncomingTransportMessage(TransportMessage incomingTransportMessage)
        {
            var safeStandardHeaders = incomingTransportMessage.Headers;
            var contentType         = incomingTransportMessage.Headers[SafeStandardHeaders.ContentType];
            var messageType         = incomingTransportMessage.Headers[SafeStandardHeaders.MessageType];
            var incomingBody        = incomingTransportMessage.Body;

            var updatedTransportMessage = incomingTransportMessage;

            if (contentType != ContentTypes.RebusContentType &&
                BodyConverter.TryConvert(incomingBody, contentType, messageType, out var convertedBody))
            {
                safeStandardHeaders[SafeStandardHeaders.ContentType] = ContentTypes.JsonContentType;
                updatedTransportMessage = new TransportMessage(safeStandardHeaders, convertedBody);
            }

            HeaderConverter.AppendRebusHeaders(safeStandardHeaders);
            return(updatedTransportMessage);
        }
Exemple #2
0
 public TransportMessage AppendAdapterSpecificHeaders(TransportMessage outgoingTransportMessage)
 {
     HeaderConverter.AppendSafeStandardHeaders(outgoingTransportMessage.Headers);
     return(outgoingTransportMessage);
 }
Exemple #3
0
 public bool IsUsableOnIncoming(TransportMessage transportMessage)
 {
     return(HeaderConverter.ContainsSafeStandardHeaders(transportMessage.Headers));
 }