public void Execute(IBaseMessageContext context) { context.EnsureFileOutboundTransport(); var outboundTransportLocation = context.GetProperty(BtsProperties.OutboundTransportLocation); var rootPath = Path.GetDirectoryName(outboundTransportLocation); if (rootPath.IsNullOrEmpty() && IO.Path.IsNetworkPath(outboundTransportLocation)) { var fileName = Path.GetFileName(outboundTransportLocation); if (!fileName.IsNullOrEmpty()) { rootPath = outboundTransportLocation.Remove(outboundTransportLocation.Length - fileName.Length); } } if (rootPath.IsNullOrEmpty()) { throw new InvalidOperationException("Root path was expected to be found in BtsProperties.OutboundTransportLocation context property."); } var subPathAndFile = context.GetProperty(BizTalkFactoryProperties.OutboundTransportLocation); if (subPathAndFile.IsNullOrEmpty()) { throw new InvalidOperationException( "Target sub path and file name were expected to be found in BizTalkFactoryProperties.OutboundTransportLocation context property."); } context.SetProperty(BtsProperties.OutboundTransportLocation, Path.Combine(rootPath !, subPathAndFile)); }
/// <summary> /// Returns the <see cref="TrackingContext"/> stored into the <paramref name="messageContext"/>. /// </summary> /// <param name="messageContext"> /// Message context that stores the <see cref="TrackingContext"/> to be returned. /// </param> /// <returns> /// The <see cref="TrackingContext"/> stored into the <paramref name="messageContext"/>. /// </returns> public static TrackingContext GetTrackingContext(this IBaseMessageContext messageContext) { if (messageContext == null) { throw new ArgumentNullException(nameof(messageContext)); } return(new TrackingContext { ProcessActivityId = messageContext.GetProperty(TrackingProperties.ProcessActivityId), ProcessingStepActivityId = messageContext.GetProperty(TrackingProperties.ProcessingStepActivityId), MessagingStepActivityId = messageContext.GetProperty(TrackingProperties.MessagingStepActivityId) }); }
public static MessageDirection FailedDirection(this IBaseMessageContext context) { if (!context.GetProperty(ErrorReportProperties.OutboundTransportLocation).IsNullOrEmpty()) { return(MessageDirection.Outbound); } if (!context.GetProperty(ErrorReportProperties.InboundTransportLocation).IsNullOrEmpty()) { return(MessageDirection.Inbound); } throw new Exception("Unable to determine message direction."); }
public static MessageDirection Direction(this IBaseMessageContext context) { // It's imperative to check outbound context properties first. If send port subscribes to a receive port, all of the // context properties of the receive location will also be present in the outbound context, though demoted, which would // confuse this code if it'd check the inbound context properties first. if (!context.GetProperty(BtsProperties.OutboundTransportLocation).IsNullOrEmpty()) { return(MessageDirection.Outbound); } if (!context.GetProperty(BtsProperties.InboundTransportLocation).IsNullOrEmpty()) { return(MessageDirection.Inbound); } throw new Exception("Unable to determine message direction."); }
public void Execute(IBaseMessageContext context) { if (context.GetProperty(TrackingProperties.ProcessName).IsNullOrEmpty()) { context.SetProcessName(Default.Processes.Failed); } }
public void Execute(IBaseMessageContext context) { if (context.GetProperty(TrackingProperties.ProcessName).IsNullOrEmpty()) { context.SetProcessName(Factory.Areas.Batch.Processes.Release); } }
public void Execute(IBaseMessageContext context) { context.EnsureSftpOutboundTransport(); var builder = new UriBuilder(context.GetProperty(BtsProperties.OutboundTransportLocation)); var folder = context.GetProperty(SftpProperties.FolderPath); var subFolderAndFile = context.GetProperty(BizTalkFactoryProperties.OutboundTransportLocation); if (subFolderAndFile.IsNullOrEmpty()) { throw new InvalidOperationException( "Target sub folder and file name were expected to be found in BizTalkFactoryProperties.OutboundTransportLocation context property."); } builder.Path = Path.Combine(folder, subFolderAndFile); context.SetProperty(BtsProperties.OutboundTransportLocation, builder.ToString()); }
public static void EnsureSftpOutboundTransport(this IBaseMessageContext context) { var outboundTransportClassId = context.GetProperty(BtsProperties.OutboundTransportCLSID).IfNotNullOrEmpty(g => new Guid(g)); if (outboundTransportClassId != SftpAdapterOutboundTransportClassId) { throw new InvalidOperationException("Outbound SFTP transport is required on this leg of the message exchange pattern."); } }
public static void EnsureFileOutboundTransport(this IBaseMessageContext context) { var fileAdapterOutboundTransportClassId = new Guid("9d0e4341-4cce-4536-83fa-4a5040674ad6"); var outboundTransportClassId = context.GetProperty(BtsProperties.OutboundTransportCLSID).IfNotNullOrEmpty(g => new Guid(g)); if (outboundTransportClassId != fileAdapterOutboundTransportClassId) { throw new InvalidOperationException("Outbound file transport is required on this leg of the message exchange pattern."); } }
public void Execute(IBaseMessageContext context) { context.EnsureSftpOutboundTransport(); // enabling IsDynamicSend is required context.SetProperty(BtsProperties.IsDynamicSend, true); var folder = context.GetProperty(SftpProperties.FolderPath); var subFolderAndFile = context.GetProperty(BizTalkFactoryProperties.OutboundTransportLocation); if (subFolderAndFile.IsNullOrEmpty()) { throw new InvalidOperationException( "Target sub folder and file name were expected to be found in BizTalkFactoryProperties.OutboundTransportLocation context property."); } var subFolder = Path.GetDirectoryName(subFolderAndFile); var file = Path.GetFileName(subFolderAndFile); context.SetProperty(SftpProperties.FolderPath, Path.Combine(folder, subFolder !).Replace('\\', '/')); context.SetProperty(SftpProperties.TargetFileName, file); }
public static bool IsAbout <T>(this IBaseMessageContext context) where T : SchemaBase { return(context.GetProperty(BtsProperties.MessageType).IsOfType <T>()); }
public static bool HasFailed(this IBaseMessageContext messageContext) { return(messageContext.GetProperty(ErrorReportProperties.ErrorType) != null); }
public static bool IsPromoted <T, TV>(this IBaseMessageContext context, MessageContextProperty <T, TV> property) where T : MessageContextPropertyBase, new() where TV : struct { return(context.GetProperty(property).HasValue&& context.IsPromoted(property.Name, property.Namespace)); }
public static bool IsPromoted <T>(this IBaseMessageContext context, MessageContextProperty <T, string> property) where T : MessageContextPropertyBase, new() { return(!context.GetProperty(property).IsNullOrEmpty() && context.IsPromoted(property.Name, property.Namespace)); }