Skip to Content

Adapter Module to stop processing of duplicate file (FTP Location)

 We had a requirement in one of our project, to stop the processing of duplicate files at the adapter level i.e. the message should not enter  the integration engine, if the file has been already processed earlier. There was a chance that client might place a file at FTP location more than ones.


Here we have used two text file at server to maintain the name of processed file and the password of the FTP. Example: name.txt and FtpPassword.txt.


The developed module code has the following functionality.

  • Whenever a file will be picked from a FTP location, the module code will check the existence of that file name in the text file placed at the server. Example name.txt.

  •  If the name of the file already exist, the code will make the file empty by making URL connection with the FTP server (so that adapter will delete that file when pinged to the server next time. For that we had set the property “do not process empty file” in the ftp channel). An error will be thrown.

  • Else the name will be written in the text file (server) i.e. name.txt.

  •  The module code will make a URL connection with the FTP server by picking the password from a text file stored at the server.Example FtpPassword.txt.


     To implement this functionality, we had written a module code. This module code will keep the name of files as record which will be checked before processing of the next file. If the file has been already processed, it will throw an error at adapter level which in turn can trigger alerts. 


For step by Step procedure of  the creation of adapter module, please refer the following pdf:


The code for the adapter module:



And to maintain jndi name edit ejb-j2ee-engine.xml:




This jndi Name will be used at the time of calling this module in communication channel.


Scenario to test the Custom Module:

Configuration of sender channel: To pick any file available at FTP location


To delete the file :


The adapter specific message attribute must be checked (so that message can hold all the checked value which will be used by module code).




The Module Tab of the Sender communication channel.




        FtpUser: user name of the client FTP        

        Location: The complete paths of the text file which will keep the record of the processed file

        PassLocation:  The complete paths of the text file which will maintain the password of the FTP client






When a new file will be placed at FTP location.Example: sanjaisw.xml



we can see in the text file name.txt : sanjaisw.xml has not been processed earlier:








The text file on the server: the file name sanjaisw.xml has been added at the last place as shown below.




Case2:    When a duplicate file will be placed at FTP location:

Example: sandeep.xml (we can see below, sandeep.xml has been already processed)




Place the file at FTP Location





After some time file will be deleted as shown below:




But this file will not be send to the integration engine as shown below. Here it is showing only one file has been processed and that is the previous one.




We can see error: Go to Runtime Workbench à Message Monitoring à select Adapter engine XI1 and click on display as shown below:


After that select your message.




And we can see there is no change in the text file that is stored at server:




You must be Logged on to comment or reply to a post.
    • Hi,

      u can implement the same just by using file methods in ur module code.
      String FileLocation = moduleContext.getContextData(“FileLocation”); //pass the complete path for the file.
      and then call

      and implementation of method will be as:

      public void DeleteFile(String FileLocation)throws Exception {          try
                File f1 = new File(filename);
            catch (Exception e){}

  • Hi Sandeep

    I tried to do operation on FTP location via custom module (operations like renaming of file at FTP location) but nothing worked. My problem is i want to rename a file at ftp location if found duplicate. Is it possible to do so please give some inputs if feasible.

    Dheeraj kumar