on 07-21-2014 7:45 AM
Hello,
We have PI 7.4 in our landscape.
There is one File To File scenario which needs to be implemented.
In this scenario, at source diretory we have multiple files (country wise) which needs to be read and put into mutiple folders (country wise) at the target directory.
Please note we are not making any objects in ESR and directly configurations need to be done in Integration Directory.
At sender side we can read mutiple files using a single Sender File adapter using the the "Advanced Selection for Source File" option.
At receiver side we are planning to implement a custom Adapter Module which will put the files in their corresponding country wise folders.
We are using NWDS 7.3 EHP 1 SP12 for building the adapter module.
Suggestions are required for below mentioned points:
1. Is the approach follwed is most suitable as we do not want to make mutiple reciever channels for each folder.
2. How to read the file name in the receiver adapter module as Namespace will not be created (we will put a dummy namespace in ID).
3. If any body has already implemented such logic or any suggestions for the same.
All the suggestions are welcome and thanks in advance.
Regards,
Ujjwal Kumar
Hi Ujjwal
I am just curious what is the reasoning behind opting for developing a custom adapter module instead of creating ESR objects.
My opinion is that an ESR mapping to handle this scenario would be easier and faster to implement, plus more "supportable" in the lifecycle of the interface.
Here is my suggestion:-
i) Sender File channel with "Advanced Selection for Source File" to poll from multiple directories
ii) Set ASMA for Filename and directory in sender file channel
iii) ESR message mapping with UDF to determine the dynamic configuration of the source directory, and then rename it to corresponding countries target directory
iv) Set ASMA for filename (so that filename is retained) and directory in Receiver file channel (value of directory changed in step iii
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Eng,
Thanks for your reply.
We are not creating ESR objects as then Data type and Message Type needs to be created and there is no processing of data involved in between, hence practically mapping is not required.
In Future if the file structure changes then these ESR objects need to be updated again.
Hence Adpater Module is being created.
Will this help in fetching the file name:
MessagePropertyKey mpk = MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
String filename = msg.getMessageProperty(mpk);
Is http://sap.com/xi/XI/System/File the default namespace ?
Hi Ujjwal
Yes, that is the correct namespace as long as you are using the File adapter.
Your code is nearly there, just need the new keyword when creating a new object instance. Below is the sample
// Get Dynamic Configuration
MessagePropertyKey fileNameKey = new MessagePropertyKey("FileName", "http://sap.com/xi/XI/System/File");
String fileName = msg.getMessageProperty(fileNameKey);
// Set Dynamic Configuration
String targetDir = "/blah/blah/blah";
MessagePropertyKey dirKey = new MessagePropertyKey("Directory", "http://sap.com/xi/XI/System/File");
msg.setMessageProperty(dirKey, targetDir );
You can refer to the following SAP JavaDocs for more infomration on the Message class (which you use to get/set the property)
Rgds
Eng Swee
Hello,
Thanks for confirming it.
Needed one more clarification.
In my case suppose I have 5 files at the sender side and read those 5 files using Sender File channel with "Advanced Selection for Source File".
So in the receiver adapter module if I create IF conditions for each File name and set the directory dynamically as mentioned by you.
Then all the files will be sent to corresponding directories right ? This means no. of times adapter module logic should run will be equal to the number of files being sent.
Or, all the files need to be collected together in reciever module and then loop over it.(which does not seems feasible as we get no of messages in SXMB_MONI as per the no. of files being read by sender file adapter).
Hope the conditons are clear, please let me know in case more information is required.
Regards,
Ujjwal Kumar
Hi Ujjwal,
When you use "Advanced Selection for Source File", each file that is polled at the sender channel will create a unique message ID. Each message is processed independently through the Adapter framework and Integration Engine, which corresponds to what you are getting in SMXB_MONI - no of messages = no of files.
So when it reaches the adapter module on the receiver channel, each will be processed separately.
Hope this answers your question.
Rgds
Eng Swee
Hello Eng,
What needs to be put in the Target Directory and File Name Scheme in the Receiver channel when we are generating the directory and file name dynamically using adapter module ?
In case of variable substitution approach we put /% Filename%/ as placeholders, I think it should be like wise ?
Regards,
Ujjwal Kumar
Hi Ujjwal
In the receiver channel, you can just put any dummy values into those two fields. It does not matter as during runtime it will use the values set in dynamic configuration (which is done at your custom module.)
Do remember to set the ASMA checkbox and check both filename and target directory.
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.