public OutPort(IItineraryStep step, string portName, string portConfig) { this.portName = portName; this.step = step; this.portConfig = portConfig; string config = this.ParseFilterConfiguration(portConfig); this.parameterCollection = this.ParsePortSettings(config); }
/// <summary> /// COnstructs OutPortCollection /// </summary> /// <param name="step"></param> public OutportCollection(IItineraryStep step) { Logger.WriteTrace("Preparing OutPort Collection List Started"); Dictionary <string, string> itineraryStepDictionary = step.PropertyBag; List <string> keyList = new List <string>(itineraryStepDictionary.Keys); OutPortList = new List <string>(); OutPortDetails = new Dictionary <string, string>(); for (int i = 0; i < keyList.Count; i++) { OutPortList.Add(keyList[i]); OutPortDetails.Add(keyList[i], itineraryStepDictionary[keyList[i]]); } this.OutPortCount = OutPortList.Count; Logger.WriteTrace("Total OutPorts: " + this.OutPortCount.ToString()); Logger.WriteTrace("Preparing OutPort Collection List Completed"); }
public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(IPipelineContext context, IBaseMessage msg, string resolverString, IItineraryStep step) { var callToken = TraceProvider.Logger.TraceIn(this.Name); try { bool IsDirectSynchronousACK = GetConfigValue <bool>(step.PropertyBag, "isDirectSynchronousACK", false); BTS.RouteDirectToTP rdttp = new BTS.RouteDirectToTP(); if (IsDirectSynchronousACK) { msg.Context.Promote(rdttp.Name.Name, rdttp.Name.Namespace, true); } else { msg.Context.Promote(rdttp.Name.Name, rdttp.Name.Namespace, false); } return(msg); } catch (Exception ex) { // put component name as a source information in this exception, // so the event log in message could reflect this ex.Source = this.Name; TraceProvider.Logger.TraceError(ex); throw ex; } finally { TraceProvider.Logger.TraceOut(callToken, this.Name); } }
public bool ShouldAdvanceStep(IItineraryStep step, IBaseMessage msg) { return(true); }
public IBaseMessage ExecuteTransform(IPipelineContext context, IBaseMessage msg, string resolverString, IItineraryStep step, bool validateSource, bool promoteDocSpecName = true) { if (context == null) { throw new ArgumentNullException("context"); } if (msg == null) { throw new ArgumentNullException("msg"); } if (string.IsNullOrEmpty(resolverString)) { throw new Exception("Resolver string is required to determine map name."); } IBaseMessage result; ArrayList mapList = new ArrayList(); string mapName = string.Empty; try { foreach (string resolver in step.ResolverCollection) { ResolverInfo resolverInfo = ResolverMgr.GetResolverInfo(ResolutionType.Transform, resolver); Dictionary <string, string> dictionary = ResolverMgr.Resolve(resolverInfo, msg, context); if (dictionary.ContainsKey("TransformType") && !string.IsNullOrEmpty(dictionary["TransformType"])) { mapList.Add(dictionary["TransformType"]); dictionary.Remove("TransformType"); } else { mapList.Add(dictionary["Resolver.TransformType"]); dictionary.Remove("Resolver.TransformType"); } } Stream stream = msg.BodyPart.GetOriginalDataStream(); if (!stream.CanSeek) { stream = new ReadOnlySeekableStream(stream) { Position = 0L }; } else { stream.Position = 0L; } string btsMsgType = msg.Context.Read(BtsProperties.MessageType.Name, BtsProperties.MessageType.Namespace) as string; string obj = null; if (string.IsNullOrEmpty(btsMsgType)) { btsMsgType = Microsoft.Practices.ESB.Utilities.MessageHelper.GetMessageType(msg, context); } mapName = GetSourceMessageMatchingMapName(mapList, btsMsgType, context); IBaseMessage baseMessage = Microsoft.Practices.ESB.Utilities.MessageHelper.CreateNewMessage(context, msg, TransformStream(stream, mapName, validateSource, ref btsMsgType, ref obj)); baseMessage.Context.Write(BtsProperties.SchemaStrongName.Name, BtsProperties.SchemaStrongName.Namespace, null); baseMessage.Context.Promote(BtsProperties.MessageType.Name, BtsProperties.MessageType.Namespace, btsMsgType); if (promoteDocSpecName) { baseMessage.Context.Write(DasmProperties.DocumentSpecName.Name, DasmProperties.DocumentSpecName.Namespace, obj); } Microsoft.Practices.ESB.Utilities.MessageHelper.SetDocProperties(context, baseMessage); result = baseMessage; } catch (Exception) { throw; } return(result); }
public IBaseMessage Execute(IPipelineContext context, IBaseMessage msg, string resolverString, IItineraryStep step) { Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name)); if (string.IsNullOrEmpty(resolverString)) { throw new ArgumentException("ResolverString is required.", "resolverString"); } IBaseMessage result; try { bool validateSource = false; bool promoteDocSpecName = true; if (step != null) { if (step.PropertyBag.ContainsKey("ValidateSource")) { validateSource = (string.Compare(step.PropertyBag["ValidateSource"], "true", true, CultureInfo.CurrentCulture) == 0); } if (step.PropertyBag.ContainsKey("PromoteDocSpecName")) { promoteDocSpecName = (string.Compare(step.PropertyBag["PromoteDocSpecName"], "false", true, CultureInfo.CurrentCulture) != 0); } } result = this.ExecuteTransform(context, msg, resolverString, step, validateSource, promoteDocSpecName); } catch (Exception ex) { Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString())); throw ex; } Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name)); return(result); }
public IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage message, string resolverString, IItineraryStep step) { Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name)); Logger.WriteTrace("Resolver String: " + resolverString); Stream inStream = null; string content = string.Empty; if (string.IsNullOrEmpty(resolverString)) { throw new ArgumentException("ResolverString is required.", "resolverString"); } try { ResolverInfo info = ResolverMgr.GetResolverInfo(ResolutionType.Transform, resolverString); if (info.Success) { Dictionary <string, string> dictionary = ResolverMgr.Resolve(info, message, pipelineContext); string action = dictionary["Cache.Action"]; string cacheMsgName = dictionary["Cache.CacheMessageName"]; int.TryParse(dictionary["Cache.CacheTimeOut"].ToString(), out defaultCacheTimeout); string key = (string)message.Context.Read(BtsProperties.InterchangeID.Name, BtsProperties.InterchangeID.Namespace) + cacheMsgName; if (action == "Get") { content = (string)this.Cache.Get(key); } else //Default action is Add { inStream = message.BodyPart.Data; using (StreamReader reader = new StreamReader(inStream)) { content = reader.ReadToEnd(); } try { this.Cache.Add(key, content, DateTime.Now.AddMinutes(defaultCacheTimeout)); } catch (ArgumentException ex) { throw new Exception("CacheService : '" + key + "' - DUPLICATE!! ERROR TYPE: " + ex.GetType().Name + " Message: " + ex.Message); } } inStream = new MemoryStream(); StreamWriter writer = new StreamWriter(inStream); writer.Write(content); writer.Flush(); inStream.Position = 0L; message = Microsoft.Practices.ESB.Utilities.MessageHelper.CreateNewMessage(pipelineContext, message, inStream); } else { throw new Exception("Unable to get cache resolver information from the resolver string: " + resolverString); } } catch (Exception ex) { Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString())); throw ex; } Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name)); return(message); }
public IBaseMessage Execute(IPipelineContext context, IBaseMessage msg, string resolverString, IItineraryStep step) { Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name)); if (context == null) { throw new ArgumentNullException("context"); } if (msg == null) { throw new ArgumentNullException("msg"); } if (string.IsNullOrEmpty(resolverString)) { throw new Exception("Resolver string is required."); } IBaseMessage result = msg; List <ManipulatorDescription> manipulatorList = new List <ManipulatorDescription>(); try { foreach (string resolver in step.ResolverCollection) { Logger.WriteTrace(" Resolver: " + resolver); ResolverInfo resolverInfo = ResolverMgr.GetResolverInfo(ResolutionType.Transform, resolver); Dictionary <string, string> dictionary = ResolverMgr.Resolve(resolverInfo, msg, context); ManipulatorDescription description = new ManipulatorDescription(); description.ReadFrom = dictionary["Resolver.ReadFrom"]; description.ReadItem = dictionary["Resolver.ReadItem"]; description.WriteTo = dictionary["Resolver.WriteTo"]; description.WriteItem = dictionary["Resolver.WriteItem"]; manipulatorList.Add(description); dictionary.Remove("Resolver.ReadFrom"); dictionary.Remove("Resolver.ReadItem"); dictionary.Remove("Resolver.WriteTo"); dictionary.Remove("Resolver.WriteItem"); } if (manipulatorList.Count > 0) { Manipulator manipulator = new Manipulator(); manipulatorList = manipulator.GetManipulationData(manipulatorList, msg, context); result = manipulator.WriteManipulationData(manipulatorList, msg, context); } } catch (Exception ex) { Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString())); throw ex; } Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name)); return(result); }
public IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage message, string resolverString, IItineraryStep step) { Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name)); Logger.WriteTrace("Resolver String: " + resolverString); if (string.IsNullOrEmpty(resolverString)) { throw new ArgumentException("ResolverString is required.", "resolverString"); } try { ResolverInfo info = ResolverMgr.GetResolverInfo(ResolutionType.Transform, resolverString); if (info.Success) { Dictionary <string, string> dictionary = ResolverMgr.Resolve(info, message, pipelineContext); // Archive the message. ArchiveManager archiveManager = new ArchiveManager(); int expiryMinutes = Convert.ToInt32(dictionary["Archive.ExpiryMinutes"]); bool includeProperties = Convert.ToBoolean(dictionary["Archive.IncludeProperties"]); string failureEventId = dictionary["Archive.FailureEventId"]; string tag = dictionary["Archive.Tag"]; string failureAction = dictionary["Archive.FailureAction"]; string messageId = archiveManager.ArchiveMessage(pipelineContext, message, expiryMinutes, includeProperties, tag); Logger.WriteTrace("Message Id: '" + messageId + "' has been archived."); SetMetadata(message, tag, messageId); } else { throw new Exception("Unable to get archive resolver information from the resolver string: " + resolverString); } } catch (Exception ex) { Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString())); throw ex; } Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name)); return(message); }
public IBaseMessage Execute(IPipelineContext context, IBaseMessage msg, string resolverString, IItineraryStep step) { Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name)); try { string ticket = new SsoTicketProvider().IssueTicket(); msg.Context.Write("SSOTicket", "http://schemas.microsoft.com/BizTalk/2003/system-properties", ticket); } catch (Exception ex) { Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString())); throw ex; } Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name)); return(msg); }