Example #1
0
 /// <summary>
 /// Update the Activity to have baggage with an additional 'key' and value 'value'.
 /// This shows up in the <see cref="Baggage"/> enumeration as well as the <see cref="GetBaggageItem(string)"/>
 /// method.
 /// Baggage is meant for information that is needed for runtime control.   For information
 /// that is simply useful to show up in the log with the activity use <see cref="Tags"/>.
 /// Returns 'this' for convenient chaining.
 /// </summary>
 /// <returns>'this' for convenient chaining</returns>
 public Activity AddBaggage(string key, string value)
 {
     _baggage = new KeyValueListNode()
     {
         keyValue = new KeyValuePair <string, string>(key, value), Next = _baggage
     };
     return(this);
 }
Example #2
0
 /// <summary>
 /// Update the Activity to have a tag with an additional 'key' and value 'value'.
 /// This shows up in the <see cref="Tags"/>  enumeration.   It is meant for information that
 /// is useful to log but not needed for runtime control (for the latter, <see cref="Baggage"/>)
 /// </summary>
 /// <returns>'this' for convenient chaining</returns>
 public Activity AddTag(string key, string value)
 {
     _tags = new KeyValueListNode()
     {
         keyValue = new KeyValuePair <string, string>(key, value), Next = _tags
     };
     return(this);
 }
Example #3
0
 /// <summary>
 /// Update the Activity to have a tag with an additional 'key' and value 'value'.
 /// This shows up in the 'Tags' eumeration.   It is meant for information that
 /// is useful to log but not needed for runtime control (for the latter, use Baggage)
 /// Returns 'this' for convinient chaining.
 /// </summary>
 public Activity WithTag(string key, string value)
 {
     // TODO what to do about duplicates?
     _tags = new KeyValueListNode()
     {
         keyValue = new KeyValuePair <string, string>(key, value), Next = _tags
     };
     return(this);
 }
Example #4
0
        public Message <TKey, TValue> AddHeader(string key, byte[] value)
        {
            var currentHeader = headers;
            var newHeaders    = new KeyValueListNode {
                KeyValue = new KeyValuePair <string, byte[]>(key, value)
            };

            do
            {
                newHeaders.Next = currentHeader;
                currentHeader   = Interlocked.CompareExchange(ref headers, newHeaders, currentHeader);
            } while (!ReferenceEquals(newHeaders.Next, currentHeader));

            return(this);
        }