Here are some tips and tricks when configuring the Watched
Folder endpoint:
If you have a watched folder on Windows that is processing
image files, specify values for the Include File Pattern or Exclude
File Pattern option to prevent the Windows auto-generated Thumbs.db
file from being polled by the watched folder.
If a cron expression is specified, the repeat interval is
ignored. The cron expression usage is based on the Quartz open source
job-scheduling system, version 1.4.0. (See Class CronTrigger.)
The batch size is the number of files or folders that will
be picked up in each scan of the watched folder. If the batch size
is set to two and ten files or folders are dropped in the watched
folder input folder, only two will be picked up in each scan. In
the next scan, which will happen after the time specified in the repeat
interval, the next two files will be picked up.
For file patterns, administrators can specify regular expressions
with added support of wild card patterns to specify file patterns.
Watched Folder modifies the regular expression to support wild card
patterns such as *.* or *.pdf. These wild card patterns are not
supported by the regular expressions.
Watched Folder scans the input folder for the input and does
not know if the source file or folder is completely copied to the
input folder before it starts processing the file or folder. To
ensure that the source file or folder is completely copied to the
input folder of the watched folder before the file or folder is
picked up, do these tasks:
Use Wait time, which is
the time in milliseconds that Watched Folder waits from the last
modified time. Use this feature if you have large files to process.
For example, if a file takes 10 minutes to download, specify the
wait time as 10*60 *1000 milliseconds. This will prevent Watched
Folder from picking up the file if it is not as old as 10 minutes.
Use exclude file pattern and include file pattern. For example,
if the exclude file pattern is ex* and the include
file pattern is in*, Watched Folder will pick up
the files that start with "in" and will not pick up the files that
start with "ex". To copy large files or folders, first rename the
file or folder so that the name starts with "ex". After the file
or folder named "ex" is completely copied to the watched folder,
rename it to "in*".
Use purge duration to keep the result folder clean. Watched
Folder cleans up all the files that are older than the duration
mentioned in the purge duration. The duration is in days.
When adding a Watched Folder endpoint, after selecting the
operation name, the input parameter mapping is populated. For each
input of the operation, one input parameter mapping field is generated.
Here are examples of input parameter mappings:
For com.adobe.idp.Document input:
If the service operation has an input of type Document,
the administrator can specify the mapping type as Variable.
Watched Folder will pick up the input from the watched folder’s
input folder based on the file pattern specified for the input parameter.
If the administrator specifies *.pdf as the parameter,
each file that has an extension of .pdf will be picked up, converted
to com.adobe.idp.Document, and the service invoked.
For java.util.Map input: If the service
operation has an input of type Map, the administrator
can specify the mapping type as Variable and enter
a mapping value with a pattern like *.pdf. For
example, a service needs a map of two com.adobe.idp.Document objects
that represent two files in the input folder such as 1.pdf and 2.pdf.
Watched Folder will create a map with the key as the filename and
the value as com.adobe.idp.Document.
For java.util.List input: If the service
operation has an input of type List, the administrator can specify
the mapping type as Variable and enter a mapping
value with a pattern like *.pdf. When PDF files
are dropped in the input folder, Watched Folder will create a list
of the com.adobe.idp.Document objects that represents
these files and invoke the target service.
For java.lang.String: The administrator
has two options. First, the administrator can specify the mapping
type as Literal and enter a mapping value as a
string, such as hello. Watched Folder will invoke
the service with the string hello. Second, the
administrator can specify the mapping type as a Variable and
enter a mapping value with a pattern like *.txt.
In the latter case, files with the .txt extension will be read as
a document coerced as a string to invoke the service.
Java primitive type: The administrator can specify the mapping
type as Literal and provide the value. Watched
Folder will invoke the service with the value specified.
Watched Folder is meant to work with documents. The supported
outputs are com.adobe.idp.Document, org.w3c.Document, org.w3c.Node,
as well as a list and map of these types. Any other type will result
in a failure output in the failure folder.
If the results are not in the result folder, verify the failure
folder to see if a failure has occurred.
Watched Folder works best if used in asynchronous mode. In
this mode, Watched Folder places the invocation request into the
queue and calls back. The queue is then processed asynchronously.
When the Asynchronous option is not set, Watched Folder invokes
the target service synchronously and the Process Engine waits until
the service is done with the request and results are produced. If
the target service takes a long time to process the request, Watched
Folder may get time-out errors.
The creation of watched folders for import and export operations
does not allow filename extension abstraction. When invoking the
Form Data Integration service using watched folders, the filename
extension type for the output file may not match the intended output
format for the document object type. For example, if the input file
to a watched folder that invokes the export operation is an XFA
form that contains data, the output should be an XDP data file.
To obtain an output file with the correct filename extension, you can
specify it in the output parameter mapping. In this example, you
can use %F.xdp for the output parameter mapping.
Watched Folder may process input files before they are completely
copied to the folder. File locking is not mandatory on UNIX as it
is on Windows. For this reason, when a file is being copied to a
watched folder, Watched Folder may move the file to stage without
waiting for the file copy to complete. This behavior causes only
a portion of the input file to be processed. There are currently
two workarounds:
Workaround 1
1. Specify a pattern
for Exclude File Pattern, such as temp*.ps.
2. Copy files
that begin with temp (for example, temp1.ps) to the watched folder.
3.
After the file has been completely copied to the watched folder,
rename the file to correspond with the pattern specified for Include
File Pattern. Watched Folder then moves the completed file to stage.
Workaround 2
If you know the maximum length of time
it will take to copy your files to a watched folder, specify the
time in seconds for Wait Time. Watched Folder then waits the specified
length of time before moving the file to stage.
This is not
an issue for files on Windows because Windows locks a file when one
thread is writing. However, this is an issue for folders on Windows.
For folders, you must follow the steps in Workaround 1.
If the Preserve Folder Name endpoint attribute for Watched
Folder is set to a null directory path, the staging directory is
not cleaned out as it should be. The directory still contains the
processed file and temporary folder.
|
|
|