Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

 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:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75...

 

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

 

 

Testing

 

Case1: 

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:

 

 

In SXMB_MONI

 

 

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:

 

 

7 Comments