I have created a FilePolling Port (Local Directory for now) and i will be polling XML, FF and MIME files and the logic is there in the service to identify the content and do the parsing accordingly.
My question is can i set any name to the input object ?
Because, when i give my custom name its not working and when i give it as ffdata its working.
I have selected WmRoot as the folder name. If i have selected WmFlatFile then i would have accepted that ffdata is ok to use.
why can’t i give my custom name here? any thoughts or suggestions?
The file will be parsed by different handlers according to content type you configured in file polling port. If you set nothing, than IS would choose the proper handler according to suffix-MIME mapping.
You can’t change the variable name, because it’s filled by handler. For example, if content type is application/xwmflatfile, then ContentHandler_FlatFile would be used and an input stream named “ffdata” will be the input.
Yes, it’s expected. It’s a better way to make service input unified, even for handling different files. In your case, you could hardcode the content type in port configuration.
But usually, one file polling port is used to process the files with the same structure.
I haven’t set any value in the port configurations for content type. So, picking up all the files and performing actions accordingly.
But you know its strange to set ffdata for content types like .jpeg/.png and etc.(Because its working only with ffdata as input)
Yes, it’s a little strange, but it could help to simplify your backend service to treat all the files in the same way. Or you have to use multiple brunch steps to guess what’s the input.
Try to use pub.flow:getTransportInfo as the first step in your handler service.U can get the file name& content-type in this service, then you can use pub.file:getFile to get content from the file.