Hotfolder
Configuration
In addition to starting workflows manually, it is also possible to start certain workflows automatically. This is done in conjunction with a so-called "hotfolder". A hotfolder is a folder that is under observation: if a SIP is stored in it, the processing of this SIP automatically starts with a specific workflow.
The configuration of such hotfolders is done in the file <installation directory>\config\doc_observer.yml
.
label_of__hotfolder:
directory_watcher:
directory: /tmp # directory to watch
glob: */** # pattern for files to watch
interval: 5.0 # interval between runs (in seconds)
stable: 2 # number of runs until a file is stable (only trigger when copying is finished)
persist: /tmp/dw_state.yml # path for persistence file
webservice:
uri: localhost:3000 # uri for the webservice
user: user # user name for basic authentication
password: password123 # password for basic authentication
workflow_id: 3 # id of the workflow to execute
queue_name: fast-queue # optional queue name, if not given the organisation queue is used
# (name of the queue "Meine Organisation".paremeterize() -> "meine-organisation")
# to run the corresponding worker: "QUEUES=fast-queue rails jobs:work"
path:
parent: false # submit the parent path of the object { true | false (default) }
absolute: false # submit the absolute path of the object { true | false (default) }
extension: false # submit the filename with the extension { true | false (default) }
temporary_folder_path: C:/temp # once the file is stable, move it here and send this path to the workflow execution
Example
The following example sets up a hotfolder at C:/example
. If a ZIP file remains unchanged in this folder for 10 seconds, this file is processed with the workflow with the ID 217
. This workflow belongs in docuteam feeder to the organization with the ID 1
. If the workflow started in this way fails, the workflow with the ID 34
is executed (e.g. to send an email):
example_hotfolder: # this hotfolder is called "example_hotfolder"
directory_watcher:
directory: C:/example # the directory that is being watched
glob: '*.zip' # only ZIP files should be processed
interval: 5.0 # the duration between two checks is 5 seconds
stable: 2 # a file has to be unchanged for 2 intervals, here 10 seconds
persist: C:/temp/example_state.yml # persistence file (does not need to be created manually)
webservice:
uri: localhost:3000/organizations/1 # the hotfolder is watched by the organization no 1
user: someUserName # user name
password: somePassword # password
workflow_id: 217 # the SIP shall be processed by the workflow no 217
path:
parent: false # these three specifications determine
absolute: false # how the path to the SIP in the hotfolder
extension: false # is to be transmitted to the workflow
temporary_folder_path: C:/temp/sips # path for temporary files
Service/Daemon
For continuous monitoring of the hotfolder, a corresponding service or daemon must be set up. Under Windows this can be done for example by means of NSSM :
Parameter | Value |
---|---|
application path | ...\docuteam\apps\ruby23\bin\bundle.bat |
start directory | ...\docuteam\apps\feeder_ruby |
arguments | exec ...\docuteam\apps\ruby23\bin\ruby lib\doc_observer\ doc_observer.rb <observer_label> <observer_label> references an entry in the file doc_observer.ymlfor the above example example_hotfolder |