public Task ProcessAsync(ClientPipeContextMessage clientPipeContextMessage, ReadOnlyMemory <IClientPipe> pipeline) { clientPipeContextMessage.BasicProperties = clientPipeContextMessage.Channel !.CreateBasicProperties(); if (clientPipeContextMessage.TryGetOptionalItemValue <string>(ContentTypeKeyName, out var messageContentType)) { if (!_options.Serializers.TryGetValue(messageContentType, out var serializer)) { throw new SerializerNotFoundException($"Missing serializer for Content-Type: '{messageContentType}'"); } clientPipeContextMessage.BasicProperties.ContentType = messageContentType; clientPipeContextMessage.SerializedMessage = serializer.Invoke(clientPipeContextMessage.Message); } else if (_options.Serializer != null) { clientPipeContextMessage.BasicProperties.ContentType = _options.ContentType; clientPipeContextMessage.SerializedMessage = _options.Serializer.Invoke(clientPipeContextMessage.Message); } else { throw new SerializerNotFoundException($"No default serializer defined. You need to define a default serializer if you don't specify message Content-Type"); } return(ProcessNextAsync(clientPipeContextMessage, pipeline)); }
public Task ProcessAsync(ClientPipeContextMessage context, ReadOnlyMemory <IClientPipe> pipeline) { if (context.TryGetOptionalItemValue <int>(ContextItemExpirationKey, out var expiration)) { context.BasicProperties !.Expiration = expiration.ToString(); } else if (_expiration != null) { context.BasicProperties !.Expiration = _expiration; } return(ProcessNextAsync(context, pipeline)); }