Dies ist eine alte Version des Dokuments!
Automatisierung von Workflow-Ausführungen über Observer
Es ist möglich, einen oder mehrere Workflows mit Observern (überwachte Ordner) zu verbinden und so automatisiert zu starten. Die Konfiguration dazu wird in der Datei config\doc_observer.yml vorgenommen.
hotfolder_xy: # label of the observer 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 persist: /tmp/dw_state.yml # path for persistance file webservice: uri: localhost:3000 # uri for the webservice user: user # user name for basic authentication password: passwort123 # password for basic authentication #Use one of these configuration parameters to define which workflow(s) to execute workflow_id: 3 # id of the workflow to execute or... workflow_ids: [1, 2] # ...a list of workflow ids to execute teardown_workflow_id: 1 # this workflow gets executed when a worfklow in the list failes (used to clean-up, send message, etc.) 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) }
Gestartet wird ein solcher observer über dessen label:
ruby lib/doc_observer/doc_observer.rb [observer label]
Das „observer label“ referenziert dabei ein entsprechendes Label im doc_observer.yml.
Ein Service oder Dämon zur Überwachung des Ordners muss entsprechend eingerichtet werden.
Beispiel nssm
Um einen Service mit nssm einzurichten, werden folgende Parameter benötigt:
Applikationspfad: %APPS%\ruby23\bin\bundle.bat
Start-Verzeichnis: %APPS%\feeder_ruby
Argumente: exec %APPS%\ruby23\bin\ruby lib\doc_observer\doc_observer.rb hotfolder_xy
Wobei die Bezeichnung des hotfolder_xy mit der Bezeichnung in doc_observer.yml übereinstimmen muss.