Filter Customization

When working with Azure Blob storage, the spring configuration file contains Azure-specific Spring beans. Use filter beans to modify the filters in your Cloud Hot Folder filter list.

The <HYBRIS_BIN_DIR>/ext-cloud/azurecloudhotfolder/resources/azurecloudhotfolder-spring.xml is the source of configuration for Azure-specific Spring beans. In the following example, notice the bean for the AzureBlobInboundSynchronizer as well as the filter and comparator beans.
<!-- Azure Inbound File Synchronizer and Channel Adapter -->
 
<alias name="defaultAzureBlobInboundSynchronizer" alias="azureBlobInboundSynchronizer"/>
<bean id="defaultAzureBlobInboundSynchronizer"
      class="de.hybris.platform.cloud.azure.hotfolder.remote.inbound.AzureBlobInboundSynchronizer">
    <constructor-arg name="sessionFactory" ref="azureBlobSessionFactory"/>
    <property name="remoteDirectory" value="#{azureHotfolderRemotePath}"/>
    <property name="moveToRemoteDirectory" value="#{azureHotfolderProcessingRemotePath}"/>
    <property name="deleteRemoteFiles" value="${azure.hotfolder.storage.delete.remote.files}"/>
    <property name="preserveTimestamp" value="true"/>
    <property name="filter" ref="azureHotfolderFileFilter"/>
    <property name="comparator" ref="azureHotFolderFileComparator"/>
</bean>
Here is a sample filter.
<alias name="azureChainFileListFilter" alias="azureHotfolderFileFilter"/>
<bean id="azureChainFileListFilter"
      class="de.hybris.platform.cloud.commons.spring.integration.file.filters.ChainFileListFilter">
    <constructor-arg name="fileFilters" ref="azureHotfolderFileFilterList"/>
</bean>

Modify Filters

Add or remove filters by adding filter beans to the filter list. A filter bean is a class that extends part of the Spring AbstractFileListFilter.<F> hierarchy, where <F> is a CloudBlob in an Azure implementation.

azureHotfolderFileFilterList

<alias name="defaultAzureFileFilterList" alias="azureHotfolderFileFilterList"/>
<util:list id="defaultAzureFileFilterList">
    <ref bean="azureBlobRegexPatternFileListFilter"/>
    <ref bean="azureBlobPersistentAcceptOnceListFilter"/>
</util:list>

Guarantee Once-Only Processing

The azureBlobPersistentAcceptOnceListFilter takes a 'store' parameter that is easily swapped from the in-memory hotfolderMetadataStore to the cluster-wide persistentHotfolderMetadataStore.

Here is an example of a filter list with in-memory metadata store.

<alias name="defaultAzureBlobPersistentAcceptOnceListFilter"
       alias="azureBlobPersistentAcceptOnceListFilter"/>
<bean id="defaultAzureBlobPersistentAcceptOnceListFilter"
      class="de.hybris.platform.cloud.azure.hotfolder.remote.file.filters.AzureBlobPersistentAcceptOnceListFilter">
    <constructor-arg name="store" ref="hotfolderMetadataStore"/>
    <constructor-arg name="prefix" value="${azure.hotfolder.storage.metadatastore.prefix}"/>
</bean>

Here is an example of a filter list with cluster-wide persistent metadata store.

<alias name="defaultAzureBlobPersistentAcceptOnceListFilter"
       alias="azureBlobPersistentAcceptOnceListFilter"/>
<bean id="defaultAzureBlobPersistentAcceptOnceListFilter"
      class="de.hybris.platform.cloud.azure.hotfolder.remote.file.filters.AzureBlobPersistentAcceptOnceListFilter">
    <constructor-arg name="store" ref="persistentMetadataStore"/>
    <constructor-arg name="prefix" value="${azure.hotfolder.storage.metadatastore.prefix}"/>
</bean>