In the below process flow, first decision box checks the polling status.
The second decision box is used to check whether the extension of the file name is “txt”. In case the filename extension is “txt” then it executes File_ soc and then File Target activity.
Following is the Java Condition which is used to fetch the file name extension and take the decision:
import java.util.*;
HashMap eventMap = new HashMap();
eventMap = (HashMap)context.get("EventContextMap");
if(eventMap != null){
String fileLoc = eventMap.get("filePath");
if(fileLoc != null){
String fileExt = fileLoc.substring(fileLoc.lastIndexOf(".")+1,fileLoc.length());
context.put("pollingFileExt",fileExt);
System.out.println("************************polling file nmae: "+fileExt);
if(fileExt.equalsIgnoreCase("txt")){
return true;
}else{
return false;
}
}
}
In case the file name extension is not txt then File_soc1 activity is executed.
Both the source activities are first connected to a Stream Selector and then Stream Selector is connected with a File Target activity. (To know more about Stream Selector, refer to Using Stream Selector section of user guide.)
Both the File Source activity has event context enabled.
The File target activity has Append property set to true.
Comments
0 comments
Article is closed for comments.