/// <summary> /// Clear the <see cref="TrackingContext"/> associated to the <paramref name="message"/>. /// </summary> /// <param name="message"> /// Message whose associated <see cref="TrackingContext"/> will be cleared. /// </param> public static void ClearTrackingContext(this IBaseMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } message.DeleteProperty(TrackingProperties.ProcessActivityId); message.DeleteProperty(TrackingProperties.ProcessingStepActivityId); message.DeleteProperty(TrackingProperties.MessagingStepActivityId); }
public static Type ResolvePluginType <T>(this IBaseMessage message, MessageContextProperty <T, string> messageContextProperty, Type configuredPluginType) where T : MessageContextPropertyBase, new() { // look after plugin type name in message context var pluginTypeName = message.GetProperty(messageContextProperty); if (!pluginTypeName.IsNullOrEmpty()) { // remove plugin type name from context to ensure no one else will use it too message.DeleteProperty(messageContextProperty); if (_logger.IsDebugEnabled) { _logger.Debug($"Using message context's plugin type '{pluginTypeName}'."); } return(Type.GetType(pluginTypeName, true)); } // use plugin type configured at pipeline level if no one found in context if (configuredPluginType != null) { if (_logger.IsDebugEnabled) { _logger.Debug($"Using configured plugin type '{configuredPluginType.AssemblyQualifiedName}'."); } return(configuredPluginType); } return(null); }