Sometimes we have to check if a file has been written on a file system and perform actions 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:
- Schedule a Trigger that runs the File Check periodically (based on your requirement)
- Read the directory of the NFS/FTP/SFTP using the FileReader Adapter
- Sender: SOAP Message coming from WHINT MessageTrigger Job
- Receiver: FileReader Query using WHINT FileReader Adapter
- Both sides use BusinessComponent “FileChecker” here
Create Business Component:
Define iFlow/IntegratedConfiguration (SOAP to FileReader):
Configure the FileReader Adapter Channel with the file name you look for:
As the FileReader Adapter reads synchronously, we have to switch from Async to Sync using the RequestResponseBean and back to Async using the RequestOnewayBean:
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:
Set up a MessageTriggerJob in NWA / Operations / Jobs according to your needs (the period is configurable very flexible: daily / every 10 minutes / …):
If the file can not be found, the message goes into error:
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.
This blog is using the following stand-alone solutions: