Problem statement: create zero (0) byte trigger file after creation of file successfully at receiver side in pass through scenario.
Business Requirement: many times we have requirement to create 1 trigger file without any data after PI creates any data file successfully at receiver side.
In this blog I will be transferring “ testing_successful.txt” file from X location to location Y using pass through scenarios and after transfer ,trigger file with 0 byte size will be created at receiver location with the same time stamp as the main file.
Assumptions
- Input file name : testing_successful.txt
- Output file name : testing_successful.txt (timestamp 20170417 09:07:00)
- Trigger file name : testing_successful.trg (timestamp 20170417 09:07:00)
Enterprise Service Repository development :
- Create DATATYPE for input message (as per your input file)
- Create DATATYPE for trigger file (it will be same for all trigger file not dependent on your input and output data structure)
- Create Message type for Input and Trigger File data type
- Create Service interfaces for both Message types
- Create message mapping for trigger file
Map root node of output structure with UDF.
Here is the code for UDF
----------------
String filename = new String("");
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = conf1.get(key1);
filename = filename.replaceAll( ".txt" ,".trg" );
conf1.put(key1,filename);
return filename;
---------------------------------------
replace input file extension with any other extension. (here I am replacing .txt with .trg)
No other mapping required.
- Create operation mapping
Activate all objects.
Here ESR development completed.
-------------------------------------------------------
Integration Directory Configuration:
- Create Configuration scenario.
- Create Business System for sender and receiver (I have used the same BS for both)
- Create sender channel as per given details(I have used File (NFS) adapter)
- Use ASMA option checked
- Create Receiver channel for file1 (main file with data) (I have used File(NFS)adapter)
- ASMA should be checked
- Create receiver channel for empty trigger file (file (NFS) used)
- File Construction mode :create
- In the advanced tab :Use ASMA
- Now go to Module tab and module in the given sequence :
localejbs/AF_Modules/MessageTransformBean
4. Now provide parameter value for above mention modules (all values here are independent of your input message so just copy them as it is.
- Create interface determination
- While adding Receiver Interface details provide dummy values for 1st row(as its pass-through scenario)
- Add operation mapping for trigger file in 2nd
- Don’t forget to check Maintain Order at runtime check box
- Create Receiver Determination
- Create sender and receiver agreement for respective channels.
- Save all objects and activate it.
- Now test the scenario
2 files successfully created ,1 with data and other one empty file
--------------------------------------------------------------------------------------------------------------------------------------
Please go through the link to access the document with screen shots :
https://drive.google.com/open?id=0B7Pvel0dS_4nOTF2LUxVMXBjUXM
Thanks,
Pooja Tiwari