8 Replies Latest reply: Jul 27, 2014 9:29 PM by 991448 RSS

    How to make BPEL File Adapter read only new files?

    979738

      Hello


      we have BPEL processes that define to run from bpel component - file adatper-

      when a file come into location that it is path on the linux server . the bpel start run when "File Adapter" bpel component recognize that new file come to the location. its PollingFrequency define to 5. property name="DeleteFile" value="false" so the files remaine there.

      we want to migrate the bpel to new SOA version so we did export and deploy to new SOA Domain.

      the location of the file adapter is the same.

      but when the BPEL processes deployed its start to run for all the files that are in this location- that the file adapter define on .

      even the original soa tooks those files and start the BPEL processes for each one of them. also the new SOA that we did deploy to the BPEL processes take those files even if they are very old.

      we want the file adatper we take only new files . the start point is the time when we do deploy to the process so if we do deploy in 10:00 am we dont want this bpel will take files from 9:00 or earlier time

      Please help , how we can do this?

      Thanks

        • 1. Re: How to make BPEL File Adapter read only new files?
          Ankit kalanoria

          Ideally we should define post read strategy for already read files to move those into different location or archive.

           

          But still If you have manual strategy based on time definition then if I remember correctly, there is option in file adapter polling configuration wizard to filter out files based on age(we can define that do not read a file if it is older than specified time duration). I call this manual strategy because if you do this then you will have to make sure that combination of timings to put new file in folder and polling frequency of adapter is synchronized accordingly with the age parameter you define here.

           

          Just explore on that direction if it is helpful.

          • 2. Re: How to make BPEL File Adapter read only new files?
            979738

            Hi

            this is exactly what I ask

            what is the File adapte propertiy's name for polling configuration wizard to filter out files based on age

            I searched but didnt found .

            thank you

            • 3. Re: How to make BPEL File Adapter read only new files?
              Ankit kalanoria

              Ok, I see where I was going wrong with this. I was talking about "Min File Age" parameter but your usecase requires something like "Max File Age" parameter. I think it is currently not there but it looks interesting option if oracle want to look into it.

               

              For now, I can think of 1 way for your usecase. Please follow lead below:

              • Create File read adapter but do not read content. It will just read all the metadata of your files one by one and will instantiate state of process/thread with it.
              • In your process or proxy, have an if-else where you will check LastModifiedTimestamp meta data retrieved from file adapter and will check that it should be less than your defined time limit.
              • It it fits your criteria then do a sync file read and pass the parameter for filename and directories from input file adapter to read content of the file and do further processing. else do nothing.
              • After invoking sync file adapter(since it is outbound), you will receive file content in output of invocation and you can processs it further as per your need in rest of the pipeline/process.

               

              Below is a good blog which implements something similar. Of-course not exactly same but all you have to do is tweak configuration mentioned below little bit to change conditions as per your need.

               

              http://technology.amis.nl/2014/05/07/processing-large-files-through-soa-suite-using-synchronous-file-read/

               

              Regards,

              ANkit

              • 4. Re: How to make BPEL File Adapter read only new files?
                991448

                Oracle JCA Adapter for Files/FTP - 11g Release 1 (11.1.1.6.2)

                Inbound Headers

                Apart from the payload, Oracle File Adapter publishes the following header metadata, from the inbound service, as shown in Figure 4-24:

                • jca.file.FileName: file name
                • jca.file.Directory: directory name
                • jca.file.Batch: a unique name for a batch in case of debatching
                • jca.file.BatchIndex: the batch index for each message within the batch for debatching
                • jca.file.Size: the file size
                • jca.file.LastModifiedTime: the last modified time for the file

                 

                Capture the jca.file.LastModifiedTime compare it with whatever time is required. If jca.file.LastModifiedTime < 10:00 AM then do not action, else perform the action.

                • 6. Re: How to make BPEL File Adapter read only new files?
                  Ankit kalanoria

                  Only reason that i suggested to use "do not read file content" option is because it will help to avoid reading unnecessary files. If file adapter is doing any native translation then if we don't do this then also adapter engine will do its work on even redundant file.

                  • 7. Re: How to make BPEL File Adapter read only new files?
                    979738

                    thank you

                    do you kno hat the value means in the example:

                    Java mon amour: File Adapter metadata with SOA Suite

                     

                    <property name="jca.file.LastModifiedTime" value="1293041258635">

                     

                    what should I rite for read only the files that are only neer then yesterday?

                    • 8. Re: How to make BPEL File Adapter read only new files?
                      991448

                      I guess this is the date format in java, date.getTime() method in java returns a long value. For example if the file modified time is  "Jul 27, 2014 5:53 PM"; then the value returned in soa composite  is 1406501580000. This value is same as java value returned by the following java code:-

                       

                      String dateString = "Jul 27, 2014 5:53 PM";

                        DateFormat format =

                                  DateFormat.getDateTimeInstance(

                                  DateFormat.MEDIUM, DateFormat.SHORT);

                       

                        Date date1 = format.parse(dateString);

                        System.out.println("date1::"+ date1.getTime());