本文整理汇总了C#中BrokeredMessage.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# BrokeredMessage.Clone方法的具体用法?C# BrokeredMessage.Clone怎么用?C# BrokeredMessage.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrokeredMessage
的用法示例。
在下文中一共展示了BrokeredMessage.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAndCreateQueueIfNotExistsAsync
public static async Task SendAndCreateQueueIfNotExistsAsync(this MessageSender sender, BrokeredMessage message,
Guid functionInstanceId, NamespaceManager namespaceManager, AccessRights accessRights, CancellationToken cancellationToken)
{
if (sender == null)
{
throw new ArgumentNullException("sender");
}
else if (namespaceManager == null)
{
throw new ArgumentNullException("namespaceManager");
}
ServiceBusCausalityHelper.EncodePayload(functionInstanceId, message);
bool threwMessgingEntityNotFoundException = false;
cancellationToken.ThrowIfCancellationRequested();
try
{
await sender.SendAsync(message);
return;
}
catch (MessagingEntityNotFoundException)
{
if (accessRights != AccessRights.Manage)
{
// if we don't have the required rights to create the queue,
// rethrow the exception
throw;
}
threwMessgingEntityNotFoundException = true;
}
Debug.Assert(threwMessgingEntityNotFoundException);
cancellationToken.ThrowIfCancellationRequested();
try
{
await namespaceManager.CreateQueueAsync(sender.Path);
}
catch (MessagingEntityAlreadyExistsException)
{
}
// Clone the message because it was already consumed before (when trying to send)
// otherwise, you get an exception
message = message.Clone();
cancellationToken.ThrowIfCancellationRequested();
await sender.SendAsync(message);
}
示例2: AfterReceiveMessage
public BrokeredMessage AfterReceiveMessage(BrokeredMessage message, WriteToLogDelegate writeToLog = null)
{
if (message == null)
{
return null;
}
var stream = message.Clone().GetBody<Stream>();
if (stream == null)
{
return null;
}
if (stream.CanSeek)
{
stream.Seek(0, SeekOrigin.Begin);
}
message.SetBodyStream(Decompress(stream));
return message;
}
示例3: Run
public async Task Run(
string namespaceAddress,
string basicQueueName,
string basicQueue2Name,
string sendKeyName,
string sendKey,
string receiveKeyName,
string receiveKey)
{
var tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(sendKeyName, sendKey);
var primaryFactory = MessagingFactory.Create(
namespaceAddress,
new MessagingFactorySettings {TokenProvider = tokenProvider, TransportType = TransportType.Amqp});
var secondaryFactory = MessagingFactory.Create(
namespaceAddress,
new MessagingFactorySettings {TokenProvider = tokenProvider, TransportType = TransportType.Amqp});
try
{
// Create a primary and secondary queue client.
var primaryQueueClient = primaryFactory.CreateQueueClient(basicQueueName);
var secondaryQueueClient = secondaryFactory.CreateQueueClient(basicQueue2Name);
Console.WriteLine("\nSending messages to primary and secondary queues...\n");
for (var i = 1; i <= 5; i++)
{
// Create brokered message.
var m1 = new BrokeredMessage("Message" + i)
{
MessageId = i.ToString(),
TimeToLive = TimeSpan.FromMinutes(2.0)
};
// Clone message so we can send clone to secondary in case sending to the primary fails.
var m2 = m1.Clone();
var exceptionCount = 0;
// send messages
var t1 = primaryQueueClient.SendAsync(m1);
var t2 = secondaryQueueClient.SendAsync(m2);
// collect result for primary queue
try
{
await t1;
Console.WriteLine("Message {0} sent to primary queue: Body = {1}", m1.MessageId, m1.GetBody<string>());
}
catch (Exception e)
{
Console.WriteLine("Unable to send message {0} to primary queue: Exception {1}", m1.MessageId, e);
exceptionCount++;
}
// collect result for secondary queue
try
{
await t2;
Console.WriteLine("Message {0} sent to secondary queue: Body = {1}", m2.MessageId, m2.GetBody<string>());
}
catch (Exception e)
{
Console.WriteLine("Unable to send message {0} to secondary queue: Exception {0}", m2.MessageId, e);
exceptionCount++;
}
// Throw exception if send operation on both queues failed.
if (exceptionCount > 1)
{
throw new Exception("Send Failure");
}
}
Console.WriteLine("\nAfter running the entire sample, press ENTER to clean up and exit.");
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("Unexpected exception {0}", e);
throw e;
}
finally
{
// Closing factories closes all entities created from these factories.
primaryFactory?.Close();
secondaryFactory?.Close();
}
}
示例4: GetMessageAndProperties
/// <summary>
/// Gets the message body and properties.
/// </summary>
/// <param name="builder">The string builder object used to accumulate the trace message.</param>
/// <param name="inboundMessage">The inbound message.</param>
/// <param name="encoder">The message encoder used to decode a WCF message.</param>
public void GetMessageAndProperties(StringBuilder builder, BrokeredMessage inboundMessage, MessageEncoder encoder)
{
string messageText = null;
Stream stream = null;
if (inboundMessage == null)
{
return;
}
try
{
var messageClone = inboundMessage.Clone();
stream = messageClone.GetBody<Stream>();
if (stream != null)
{
var stringBuilder = new StringBuilder();
var message = encoder.ReadMessage(stream, MaxBufferSize);
using (var reader = message.GetReaderAtBodyContents())
{
// The XmlWriter is used just to indent the XML message
var settings = new XmlWriterSettings { Indent = true };
using (var writer = XmlWriter.Create(stringBuilder, settings))
{
writer.WriteNode(reader, true);
}
}
messageText = stringBuilder.ToString();
}
}
catch (Exception)
{
try
{
var messageClone = inboundMessage.Clone();
stream = messageClone.GetBody<Stream>();
if (stream != null)
{
var message = encoder.ReadMessage(stream, MaxBufferSize);
using (var reader = message.GetReaderAtBodyContents())
{
messageText = reader.ReadString();
}
}
}
catch (Exception)
{
try
{
if (stream != null)
{
try
{
stream.Seek(0, SeekOrigin.Begin);
var serializer = new CustomDataContractBinarySerializer(typeof(string));
messageText = serializer.ReadObject(stream) as string;
}
catch (Exception)
{
try
{
stream.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(stream))
{
messageText = reader.ReadToEnd();
}
}
catch (Exception)
{
messageText = UnableToReadMessageBody;
}
}
}
else
{
messageText = UnableToReadMessageBody;
}
}
catch (Exception)
{
messageText = UnableToReadMessageBody;
}
}
}
builder.AppendLine(ReceivedMessagePayloadHeader);
builder.AppendLine(string.Format(MessageTextFormat, messageText));
if (inboundMessage.Properties.Any())
{
builder.AppendLine(ReceivedMessagePropertiesHeader);
foreach (var p in inboundMessage.Properties)
{
builder.AppendLine(string.Format(MessagePropertyFormat,
p.Key,
p.Value));
}
//.........这里部分代码省略.........
示例5: GetMessageText
/// <summary>
/// Reads the content of the BrokeredMessage passed as argument.
/// </summary>
/// <param name="messageToRead">The BrokeredMessage to read.</param>
/// <param name="bodyType">BodyType</param>
/// <returns>The content of the BrokeredMessage.</returns>
public string GetMessageText(BrokeredMessage messageToRead, out BodyType bodyType)
{
string messageText = null;
Stream stream = null;
bodyType = BodyType.Stream;
if (messageToRead == null)
{
return null;
}
var inboundMessage = messageToRead.Clone();
try
{
stream = inboundMessage.GetBody<Stream>();
if (stream != null)
{
var element = new BinaryMessageEncodingBindingElement
{
ReaderQuotas = new XmlDictionaryReaderQuotas
{
MaxArrayLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxDepth = int.MaxValue,
MaxNameTableCharCount = int.MaxValue,
MaxStringContentLength = int.MaxValue
}
};
var encoderFactory = element.CreateMessageEncoderFactory();
var encoder = encoderFactory.Encoder;
var stringBuilder = new StringBuilder();
var message = encoder.ReadMessage(stream, MaxBufferSize);
using (var reader = message.GetReaderAtBodyContents())
{
// The XmlWriter is used just to indent the XML message
var settings = new XmlWriterSettings { Indent = true };
using (var writer = XmlWriter.Create(stringBuilder, settings))
{
writer.WriteNode(reader, true);
}
}
messageText = stringBuilder.ToString();
bodyType = BodyType.Wcf;
}
}
catch (Exception)
{
inboundMessage = messageToRead.Clone();
try
{
stream = inboundMessage.GetBody<Stream>();
if (stream != null)
{
var element = new BinaryMessageEncodingBindingElement
{
ReaderQuotas = new XmlDictionaryReaderQuotas
{
MaxArrayLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxDepth = int.MaxValue,
MaxNameTableCharCount = int.MaxValue,
MaxStringContentLength = int.MaxValue
}
};
var encoderFactory = element.CreateMessageEncoderFactory();
var encoder = encoderFactory.Encoder;
var message = encoder.ReadMessage(stream, MaxBufferSize);
using (var reader = message.GetReaderAtBodyContents())
{
messageText = reader.ReadString();
}
bodyType = BodyType.Wcf;
}
}
catch (Exception)
{
try
{
if (stream != null)
{
try
{
stream.Seek(0, SeekOrigin.Begin);
var serializer = new CustomDataContractBinarySerializer(typeof(string));
messageText = serializer.ReadObject(stream) as string;
bodyType = BodyType.String;
}
catch (Exception)
{
try
{
stream.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(stream))
{
messageText = reader.ReadToEnd();
if (messageText.ToCharArray().GroupBy(c => c).
//.........这里部分代码省略.........
示例6: SendMessage
/// <summary>
/// This method can be used to send a message to a queue or a topic.
/// </summary>
/// <param name="messageSender">A MessageSender object used to send messages.</param>
/// <param name="message">The message to send.</param>
/// <param name="taskId">The sender task id.</param>
/// <param name="isBinary">Indicates if the body is binary or not.</param>
/// <param name="useWcf">Indicates whether to send messages to a WCF receiver.</param>
/// <param name="logging">Indicates whether logging of message content and properties is enabled.</param>
/// <param name="verbose">Indicates whether verbose logging is enabled.</param>
/// <param name="elapsedMilliseconds">The time spent to send the message.</param>
public void SendMessage(MessageSender messageSender,
BrokeredMessage message,
int taskId,
bool isBinary,
bool useWcf,
bool logging,
bool verbose,
out long elapsedMilliseconds)
{
if (messageSender == null)
{
throw new ArgumentNullException(MessageSenderCannotBeNull);
}
if (message == null)
{
throw new ArgumentNullException(BrokeredMessageCannotBeNull);
}
var stopwatch = new Stopwatch();
try
{
Stream bodyStream = null;
if (logging && verbose)
{
bodyStream = message.Clone().GetBodyStream();
}
var builder = new StringBuilder();
try
{
stopwatch.Start();
messageSender.Send(message);
}
finally
{
stopwatch.Stop();
}
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
if (logging)
{
builder.AppendLine(string.Format(CultureInfo.CurrentCulture, MessageSuccessfullySent,
taskId,
string.IsNullOrWhiteSpace(message.MessageId) ? NullValue : message.MessageId,
string.IsNullOrWhiteSpace(message.SessionId) ? NullValue : message.SessionId,
string.IsNullOrWhiteSpace(message.Label) ? NullValue : message.Label,
message.Size));
if (verbose)
{
builder.AppendLine(SentMessagePayloadHeader);
var messageText = GetMessageText(bodyStream, isBinary);
if (useWcf)
{
messageText = XmlHelper.Indent(messageText);
}
builder.AppendLine(string.Format(MessageTextFormat, messageText.Contains('\n') ? messageText : messageText.Substring(0, Math.Min(messageText.Length, 128)) + (messageText.Length >= 128 ? "..." : "")));
if (message.Properties.Any())
{
builder.AppendLine(SentMessagePropertiesHeader);
foreach (var p in message.Properties)
{
builder.AppendLine(string.Format(MessagePropertyFormat,
p.Key,
p.Value));
}
}
}
var traceMessage = builder.ToString();
WriteToLog(traceMessage.Substring(0, traceMessage.Length - 1));
}
}
finally
{
message.Dispose();
}
}
示例7: CreateMessageForWcfReceiver
/// <summary>
/// Create a BrokeredMessage for a WCF receiver.
/// </summary>
/// <param name="messageTemplate">The message template.</param>
/// <param name="taskId">The task Id.</param>
/// <param name="updateMessageId">Indicates whether to use a unique id for each message.</param>
/// <param name="oneSessionPerTask">Indicates whether to use a different session for each sender task.</param>
/// <param name="to">The uri of the target topic or queue.</param>
/// <returns>The cloned BrokeredMessage object.</returns>
public BrokeredMessage CreateMessageForWcfReceiver(BrokeredMessage messageTemplate,
int taskId,
bool updateMessageId,
bool oneSessionPerTask,
Uri to)
{
string messageText;
using (var reader = new StreamReader(messageTemplate.Clone().GetBody<Stream>()))
{
messageText = reader.ReadToEnd();
}
var isXml = XmlHelper.IsXml(messageText);
var isJson = !isXml && JsonSerializerHelper.IsJson(messageText);
Message message = null;
MessageEncodingBindingElement element;
var outputStream = new MemoryStream();
if (scheme == DefaultScheme)
{
element = new BinaryMessageEncodingBindingElement();
}
else
{
element = new TextMessageEncodingBindingElement();
}
var encoderFactory = element.CreateMessageEncoderFactory();
var encoder = encoderFactory.Encoder;
if (isXml)
{
using (var stringReader = new StringReader(messageText))
{
using (var xmlReader = XmlReader.Create(stringReader))
{
using (var dictionaryReader = XmlDictionaryReader.CreateDictionaryReader(xmlReader))
{
message = Message.CreateMessage(MessageVersion.Default, "*", dictionaryReader);
encoder.WriteMessage(message, outputStream);
outputStream.Seek(0, SeekOrigin.Begin);
}
}
}
}
else
{
if (isJson)
{
message = Message.CreateMessage(MessageVersion.Default, "*", new StringBodyWriter(messageText));
encoder.WriteMessage(message, outputStream);
outputStream.Seek(0, SeekOrigin.Begin);
}
}
if (message != null && outputStream.Length > 0)
{
message.Headers.To = to;
var outboundMessage = new BrokeredMessage(outputStream, true)
{
ContentType = encoder.ContentType
};
if (!string.IsNullOrWhiteSpace(messageTemplate.Label))
{
outboundMessage.Label = messageTemplate.Label;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ContentType))
{
outboundMessage.ContentType = messageTemplate.ContentType;
}
outboundMessage.MessageId = updateMessageId ? Guid.NewGuid().ToString() : messageTemplate.MessageId;
outboundMessage.SessionId = oneSessionPerTask ? taskId.ToString(CultureInfo.InvariantCulture) : messageTemplate.SessionId;
if (!string.IsNullOrWhiteSpace(messageTemplate.CorrelationId))
{
outboundMessage.CorrelationId = messageTemplate.CorrelationId;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.To))
{
outboundMessage.To = messageTemplate.To;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ReplyTo))
{
outboundMessage.ReplyTo = messageTemplate.ReplyTo;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ReplyToSessionId))
{
outboundMessage.ReplyToSessionId = messageTemplate.ReplyToSessionId;
}
outboundMessage.TimeToLive = messageTemplate.TimeToLive;
outboundMessage.ScheduledEnqueueTimeUtc = messageTemplate.ScheduledEnqueueTimeUtc;
outboundMessage.ForcePersistence = messageTemplate.ForcePersistence;
foreach (var property in messageTemplate.Properties)
{
outboundMessage.Properties.Add(property.Key, property.Value);
//.........这里部分代码省略.........
示例8: CreateMessageForApiReceiver
/// <summary>
/// Create a BrokeredMessage object
/// </summary>
/// <param name="messageTemplate">The message template.</param>
/// <param name="taskId">The task Id.</param>
/// <param name="updateMessageId">Indicates whether to use a unique id for each message.</param>
/// <param name="oneSessionPerTask">Indicates whether to use a different session for each sender task.</param>
/// <param name="isBinary">Indicates if the body is binary or not.</param>
/// <param name="bodyType">Contains the body type.</param>
/// <param name="messageInspector">A BrokeredMessage inspector object.</param>
/// <returns>The cloned BrokeredMessage object.</returns>
public BrokeredMessage CreateMessageForApiReceiver(BrokeredMessage messageTemplate,
int taskId,
bool updateMessageId,
bool oneSessionPerTask,
bool isBinary,
BodyType bodyType,
IBrokeredMessageInspector messageInspector)
{
if (messageTemplate == null)
{
throw new ArgumentNullException(BrokeredMessageCannotBeNull);
}
var outboundMessage = messageTemplate.Clone();
if (bodyType == BodyType.String)
{
using (var reader = new StreamReader(outboundMessage.GetBody<Stream>()))
{
outboundMessage = new BrokeredMessage(reader.ReadToEnd());
}
}
outboundMessage.MessageId = updateMessageId ? Guid.NewGuid().ToString() : messageTemplate.MessageId;
outboundMessage.SessionId = oneSessionPerTask ? taskId.ToString(CultureInfo.InvariantCulture) : messageTemplate.SessionId;
if (bodyType == BodyType.String)
{
if (!string.IsNullOrWhiteSpace(messageTemplate.Label))
{
outboundMessage.Label = messageTemplate.Label;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ContentType))
{
outboundMessage.ContentType = messageTemplate.ContentType;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.CorrelationId))
{
outboundMessage.CorrelationId = messageTemplate.CorrelationId;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.To))
{
outboundMessage.To = messageTemplate.To;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ReplyTo))
{
outboundMessage.ReplyTo = messageTemplate.ReplyTo;
}
if (!string.IsNullOrWhiteSpace(messageTemplate.ReplyToSessionId))
{
outboundMessage.ReplyToSessionId = messageTemplate.ReplyToSessionId;
}
foreach (var property in messageTemplate.Properties)
{
outboundMessage.Properties.Add(property.Key, property.Value);
}
outboundMessage.TimeToLive = messageTemplate.TimeToLive;
outboundMessage.ScheduledEnqueueTimeUtc = messageTemplate.ScheduledEnqueueTimeUtc;
outboundMessage.ForcePersistence = messageTemplate.ForcePersistence;
}
if (messageInspector != null)
{
outboundMessage = messageInspector.BeforeSendMessage(outboundMessage);
}
return outboundMessage;
}
示例9: SendMessage
// Send message to active queue. If this fails, send message to backup queue.
// If the send operation to the backup queue succeeds, make the backup queue the new active queue.
async Task SendMessage(BrokeredMessage m1, int maxSendRetries = 10)
{
do
{
var m2 = m1.Clone();
try
{
await this.activeQueueClient.SendAsync(m1);
return;
}
catch
{
if (--maxSendRetries <= 0)
{
throw;
}
lock (this.swapMutex)
{
var c = this.activeQueueClient;
this.activeQueueClient = this.backupQueueClient;
this.backupQueueClient = c;
}
m1 = m2.Clone();
}
}
while (true);
}
示例10: OnMessageAsync
private async Task OnMessageAsync(BrokeredMessage message)
{
try
{
if (message == null)
{
return;
}
if (receiverBrokeredMessageInspector != null)
{
message = receiverBrokeredMessageInspector.AfterReceiveMessage(message);
}
if (logging)
{
var builder = new StringBuilder(string.Format(MessageSuccessfullyReceived,
string.IsNullOrWhiteSpace(message.MessageId)
? NullValue
: message.MessageId,
string.IsNullOrWhiteSpace(message.SessionId)
? NullValue
: message.SessionId,
string.IsNullOrWhiteSpace(message.Label)
? NullValue
: message.Label,
message.Size));
if (verbose)
{
serviceBusHelper.GetMessageAndProperties(builder, message, encoder);
}
writeToLog(builder.ToString());
}
if (tracking)
{
Invoke(new Action(() => messageBindingList.Add(message.Clone())));
//Invoke(new Action(() => messageCollection.Add(message)));
}
UpdateStatistics(1, GetElapsedTime(), message.Size);
if (receiveMode == ReceiveMode.PeekLock && !autoComplete)
{
await message.CompleteAsync();
}
}
catch (Exception ex)
{
HandleException(ex);
}
}
示例11: CloneBrokeredMessage
// Clone BrokeredMessage including system properties.
BrokeredMessage CloneBrokeredMessage(BrokeredMessage source)
{
BrokeredMessage destination = source.Clone();
destination.ContentType = source.ContentType;
destination.CorrelationId = source.CorrelationId;
destination.Label = source.Label;
destination.MessageId = source.MessageId;
destination.ReplyTo = source.ReplyTo;
destination.ReplyToSessionId = source.ReplyToSessionId;
destination.ScheduledEnqueueTimeUtc = source.ScheduledEnqueueTimeUtc;
destination.SessionId = source.SessionId;
destination.TimeToLive = source.TimeToLive;
destination.To = source.To;
return destination;
}
示例12: LogMessage
private static BrokeredMessage LogMessage(MessageDirection direction, BrokeredMessage message)
{
try
{
if (message != null)
{
messageCollection.TryAdd(new Tuple<MessageDirection, BrokeredMessage>(direction, message.Clone()));
}
}
// ReSharper disable once EmptyGeneralCatchClause
catch (Exception)
{
}
return message;
}
示例13: OnMessageAsync
public async Task OnMessageAsync(MessageSession session, BrokeredMessage message)
{
try
{
if (message == null)
{
return;
}
if (session == null)
{
return;
}
if (configuration == null)
{
return;
}
if (configuration.MessageInspector != null)
{
message = configuration.MessageInspector.AfterReceiveMessage(message);
}
if (configuration.Logging)
{
var builder = new StringBuilder(string.Format(MessageSuccessfullyReceived,
string.IsNullOrWhiteSpace(message.MessageId)
? NullValue
: message.MessageId,
string.IsNullOrWhiteSpace(message.SessionId)
? NullValue
: message.SessionId,
string.IsNullOrWhiteSpace(message.Label)
? NullValue
: message.Label,
message.Size));
if (configuration.Verbose)
{
configuration.ServiceBusHelper.GetMessageAndProperties(builder, message, configuration.MessageEncoder);
}
configuration.WriteToLog(builder.ToString(), false);
}
if (configuration.Tracking)
{
configuration.TrackMessage(message.Clone());
}
if (configuration.Graph)
{
configuration.UpdateStatistics(1, configuration.GetElapsedTime(), message.Size);
}
if (configuration.ReceiveMode == ReceiveMode.PeekLock && !configuration.AutoComplete)
{
await message.CompleteAsync();
}
if (!SessionDictionary.ContainsKey(message.SessionId))
{
SessionDictionary.Add(message.SessionId, 1);
}
else
{
SessionDictionary[message.SessionId]++;
}
}
catch (Exception ex)
{
HandleException(ex);
}
}
示例14: Clone
private BrokeredMessage Clone(BrokeredMessage msg, string newBody = null)
{
if (string.IsNullOrWhiteSpace(newBody)) return msg.Clone();
var cloned = new BrokeredMessage(new MemoryStream(Encoding.UTF8.GetBytes(newBody)), true)
{
Label = msg.Label,
ContentType = msg.ContentType,
MessageId = msg.MessageId,
SessionId = msg.SessionId,
CorrelationId = msg.CorrelationId,
To = msg.To,
ReplyTo = msg.ReplyTo,
ReplyToSessionId = msg.ReplyToSessionId,
TimeToLive = msg.TimeToLive,
ScheduledEnqueueTimeUtc = msg.ScheduledEnqueueTimeUtc,
};
foreach (var property in msg.Properties)
{
cloned.Properties.Add(property.Key, property.Value);
}
return cloned;
}
示例15: When
protected override async Task When()
{
var body = "dummy body";
_message = await Subject.Create(body);
_clone = _message.Clone();
}