NServiceBus.MsmqConfigurationExtensions.ApplyLabelToMessages C# (CSharp) Method

ApplyLabelToMessages() public static method

Set a delegate to use for applying the Message.Label property when sending a message.
This delegate will be used for all valid messages sent via MSMQ. This includes, not just standard messages, but also Audits, Errors and all control messages. In some cases it may be useful to use the Headers.ControlMessageHeader key to determine if a message is a control message. The only exception to this rule is received messages with corrupted headers. These messages will be forwarded to the error queue with no label applied.
public static ApplyLabelToMessages ( this transportExtensions, string>.Func labelGenerator ) : TransportExtensions
transportExtensions this
labelGenerator string>.Func
return TransportExtensions
        public static TransportExtensions<MsmqTransport> ApplyLabelToMessages(this TransportExtensions<MsmqTransport> transportExtensions, Func<IReadOnlyDictionary<string, string>, string> labelGenerator)
        {
            Guard.AgainstNull(nameof(labelGenerator), labelGenerator);
            transportExtensions.Settings.Set("msmqLabelGenerator", labelGenerator);
            return transportExtensions;
        }