File Processing Channels
Messaging is the foundational pattern of the Spring Integration library. File processing channels provide endpoints that accept a message, perform some processing on it, and then pass the processed message to the next channel. Message attributes dictate how information flows through the processing channels.
After synchronization and sorting, the Spring Integration creates one message per file or ZIP folder. The headers of the message contain the file name and the time of the last modification. The file name is used to route the message to the appropriate message channel. The last modified time is used for monitoring. The message is routed using a HeaderValueRouter and the custom class PatternMatchingDestinationResolver.
| Base Class/Interface | Extension | Class/Interface | Explanation |
|---|---|---|---|
| org.springframework.messaging.core.DestinationResolver | cloudcommons | PatternMatchingDestinationResolver | Attempts to locate a destination by checking if any pattern matches the required name. Otherwise, it delegates to another DestinationResolver implementation as a fallback mechanism. |
The route through file processing channels is demonstrated in the following image.
Default File Processing Channels
By default, the Cloud Hot Folder adapter attempts to import any file with a name that doesn’t start with ignore. Once the file is copied from the Blob store to the 'leader' processing node, the adapter uses a configuration map to decide which hot folder flow to use to process the file. You can add entries to this configuration map to instruct the adapter to deliver files to custom flows.
- Default Mapping Channel (batchFileCloudHotFolderDefaultProc)
- Unzip Channel (cloudHotFolderUnzipChannel)
- Unmapped Channel (unmappedHotFolderChannel)
- Default Mapping Channel: ^(customer|product|url_media)-\\d+.*
- Unzip Channel: ^(?:.*)\.(?i)(zip)$
Mappings are controlled through a Spring Map bean. The bean includes a key (Pattern) and value (MessageChannel). Since this isn’t Azure-specific, the Spring configuration resides within the Cloud Hot Folder extension, where the routing and file processing configuration is split across three Spring configuration files within <HYBRIS_BIN_DIR>/ext-cloud/cloudhotfolder/resources/cloudhotfolder/integration/.
| Configuration File | Source | Important Beans |
|---|---|---|
| hot-folder-file-routing-spring.xml |
Beans concerned with:
|
|
| hot-folder-default-mapping.xml |
Beans concerned with supporting the standard SAP Commerce Cloud data import |
batchFilesCloudHotFolderDefaultProc: The channel mapped to pattern ${cloud.hotfolder.default.mapping.file.name.pattern}. Added to hot-folder-file-routingspring.xml → hotfolderInboundFIleChannelMappings Provides the entry point for the standard SAP Commerce Cloud data import flow |
| hot-folder-zip-mapping.xml |
Beans concerned with supporting the new zip folder data import flow. |
cloudHotFolderUnzipChannel: The channel mapping to pattern ^(?:.*)\.(?i)(zip)$. Added to hot-folder-file-routingspring.xml → hotfolderInboundFIleChannelMappings Provides the entry point for the new ZIP folder data import flow unZipTransformer: An instance of the custom class CloudUnZipTransfromer that unzips a synchronized ZIP folder. |
Unmapped Channel
There is a property that controls this behavior when you want unmapped files to stop the processing of other files.
| File | Location | Configuration Items |
|---|---|---|
| project.properties | <HYBRIS_BIN_DIR>/ext-cloud/cloudhotfolder | cloud.hotfolder.storage.header.router.resolution.required: a boolean flag that specifies whether each file requires a mapped channel. If set to 'false', an unmapped file causes an exception, preventing other files from processing.
Default: false |