The Outbound File Location component allows messages to be placed in a sub folder hierarchy based on Context Properties of the Message.
The following class diagram shows the classes for the OutboundFileLocation component:
The OutboundFileLocation class derives from the PipelineComponentWithResourceBase base class and passes a name prefix and an instance to a ResourceManager to its constructor. The override of the ExecuteInternal method uses the SystemMessageContext class to check the OutboundTransportType. If the FILE adapter is not used, the component does not perform any operation and simply returns the incoming message.
Otherwise the Outbound Transport Location is parsed for a macro (e.g. %SourceFileName%) and the sub path is build retrieving the configured properties values from the current message’s context. Then the base path (configured in the Send Port), the sub path and the macro are combined and assigned to the Outbound Transport Location context property of the message.
Both the Load and Save methods are overridden to manage persistence of the configured properties. Three values are maintained for each configured property (Key, Namespace and IsLiteral) and an extra count value to indicate the number of configured properties.
The OutboundFileLocationBagNames utility class manages the names for each configured property in the persistence bag.
Download the source code here.