public static void ProcessJobServerTasks(SqlXml Message, Guid ConversationHandle) { if (Message.IsNull) { SqlContext.Pipe.Send("No message was supplied for processing."); new ServiceBroker("context connection=true;").EndDialog(ConversationHandle); return; } XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(Message.Value); // Execute the requested task IJobServerTask task = JobServerFactory.GetJobServerTask(doc.DocumentElement.Attributes["MessageTypeName"].Value); task.Execute(Message, ConversationHandle); }
private static IJobServerTask InstantiateJobTask(string fqAssemblyName) { if (null == fqAssemblyName || fqAssemblyName.Length == 0) { throw new ArgumentException("AssemblyName parameter cannot be null or empty", fqAssemblyName); } Type type = Type.GetType(fqAssemblyName); if (null == type) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Requested type {0} not found, unable to load", fqAssemblyName), "fqAssemblyName"); } ConstructorInfo ctor = type.GetConstructor(new Type[] { }); IJobServerTask task = (IJobServerTask)ctor.Invoke(new object[] { }); return(task); }