Skip to Content
Technical Articles
Author's profile photo kartik mahato

Hot Folder :-

Hot Folder :

In  hybris Hot Folder is used to insert the data from csv file to database. It’s  help the 3rd party to insert data into database directly because the 3rd party may not aware of Hybris or any Programming Language , So to help the 3rd party Hybris come up with the solution i.e. called Hot Folder.

Hot Folder Works in below steps__

a) It takes the data from csv file and convert into Impex .

b) Execute the generated Impex.

For Hot Folder we need to do some configuration in hot-folder-store-training-spring.xml file

step 1.

BaseDirectory :- Here we have to mention the location of directory from where our Hot Folder will read the file.


<bean id="baseDirectoryTraining" class="java.lang.String">
   <constructor-arg value="#{baseDirectory}/${tenantId}/training" />

step 2.

Inbound-channel-adapter :- Here we need to specify which type/Extension  of file We need to read from base directory and what the special charactor can be include in file name. Inbound-channel-adapter holds some properties ..

a) comparator : it is going to compare which file need to process first base on the Priority.

b)fixed-rate : it is used define how frequently process the file.


<file:inbound-channel-adapter id="batchFilesTraining" directory="#{baseDirectoryTraining}"
                       filename-regex="^(.*)-(\d+)\.csv" comparator="fileOrderCompartor">
   <int:poller fixed-rate="1000" />

step 3.

outbound-gateway :- Here we need to define the destination path of successfully  executed file to move from base directory to destination folder.

Outbound-gateway contain some property.

delete-source-files -: It gives boolean return type , if it’s value is true then after copying the file from base directory it will delete the file form base directory .

Example …

<file:outbound-gateway request-channel="batchFilesTraining" reply-channel="batchFilesTrainingProc"
                  directory="#{baseDirectoryTraining}/processing" delete-source-files="true" />

step 4 .

specific convertor :- here we will declare bean id of DefaultImpexConverter class. It contains some properties

a) header :- Here we declare the impex where we define our model class or table name where we are going to insert the data.

b)impexRow :- Here we bind the column number with the attribute we defined in header or impex


<bean id="unitConverter" class="de.hybris.platform.acceleratorservices.dataimport.batch.converter.impl.DefaultImpexConverter">
<property name="header">
      # Insert Apparel Products
      INSERT_UPDATE NewShop;storeId[unique=true];storeName;storeCity;storeOwnerName
   <property name="impexRow">

step 4.

Here we define the bean id of DefaultConverterMapping where we map with the bean id of specific convertor which we want to run


<bean id="unitConverterMapping"

conclusion:- This is how we can read csv file using HotFolder in hybris.

If you have any query then feel free to ask by commenting here.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.