Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
adam_kiwon3
Active Participant
0 Kudos

Sometimes we have to check if a file has been written on a file system and perform actions based on that. With PI we usually poll a directory using the File Sender Adapter (e.g. in TEST mode if we can not delete the file). Here´s a smarter way:




  1. Schedule a Trigger that runs the File Check periodically (based on your requirement)

  2. Read the directory of the NFS/FTP/SFTP using the FileReader Adapter






 

Example Configuration

  • Sender: SOAP Message coming from WHINT MessageTrigger Job (of course you can use another trigger like a file sender polling in test mode with channel scheduling)

  • Receiver: FileReader Query using WHINT FileReader Adapter

  • Both sides use BusinessComponent "FileChecker" here


 




Create Business Component:FileChecker 1

 

Define iFlow/IntegratedConfiguration (SOAP to FileReader):FileChecker 2

 

Configure the FileReader Adapter Channel with the file name you look for:FileChecker 7

 

As the FileReader Adapter reads synchronously, we have to switch from Async to Sync using the RequestResponseBean and back to Async using the RequestOnewayBean:FileChecker 8

 

If the file is found, we need to have a second (Dummy) iFlow/ICO that is receiving the Response Message from the adapter but without processing it:FileChecker 9




 

Set up a MessageTriggerJob in NWA / Operations / Jobs according to your needs (the period is configurable very flexible: daily / every 10 minutes / ...):FileChecker 4FileChecker 6

 

If the file can not be found, the message goes into error:FileChecker 5

 

VOILÁ - here is the message in error (System Error).
If you have defined alerting, an automatic E-Mail is triggered!


 

In case the file is found, no additional message is being generated. This behaviour can be changed if you change the routing of the Dummy iFlow.

2 Comments
Labels in this area