User Tools

Site Tools


evergreen-user:action_trigger

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
evergreen-user:action_trigger [2011/12/30 15:12] – more info about templates, environment and parameters. edoceoevergreen-user:action_trigger [2012/08/03 14:17] – atr example edoceo
Line 123: Line 123:
 == Event Environment == == Event Environment ==
  
-Controls which data are available when processing this trigger (Validator, Reactor, Cleanup).  Many trigger definitions include //usr//, //target_copy//, //pickup_lib// or //target_copy.call_number.record.simple_record//.+Controls which data are available when processing this trigger (Validator, Reactor, Cleanup).  Many trigger definitions include //usr//, //target_copy//, //pickup_lib// or //target_copy.call_number.record.simple_record//.  The Event Environment values are paths to objects in the system.  This data is stored in action_trigger.environment, bound to action_trigger.event_definition via event_def.
  
 == Event Parameters == == Event Parameters ==
  
-This allows one to define key/value type data which becomes available during the processing of the trigger (Validator, Reactor).  These options may be useful when creating custom validators for example.  The Parameter Name should match ///[\w,\-\.]+///, but just ///\w+/// is more practical.  The Parameter Value must match ///\w+///, other values seem to get lost or mangled  See usage in ''Validator.pm''+This allows one to define key/value type data which becomes available during the processing of the trigger (Validator, Reactor).  These options may be useful when creating custom validators for example.  The Parameter Name can match ///[\w,\-\.]+///, but just ///\w+/// is more practical.  The Parameter Value is eval'd on the server side, so they must be stored as valid Perl values.  For strings, wrap them in quotes.  This data is stored in action_trigger.event_params, also bound by event_def.
  
 +===== Processing Action Triggers =====
 +
 +When events occur records are created in the action_trigger.event table and these events are processed by the action_trigger_runner.pl script.  Usually as a set of cron tasks for the opensrf user.
 +
 +<code>
 +# General A/T
 +*/2 * * * * action_trigger_runner.pl --process-hooks --run-pending
 +
 +# Run Specific Granularity Only
 +20 20 * * * action_trigger_runner.pl --run-pending --granularity Daily-Active-Report --granularity-only
 +
 +# Just do these hooks
 +21 21 * * * action_trigger_runner.pl --run-pending --hooks=checkout
 +
 +# Example with Wrapper
 +4 4 * * * /openils/cron/daily-overdue.sh
 +</code>
 +
 +It's not uncommon to have dozens of entries in the crontab for Evergreen.  One may also want to create create wrapper shell scripts for the action_trigger_runner script to permit in-line documentation or other features.  Here is an example.
 +
 +<code>
 +#!/bin/bash
 +# I'm some documentation on this script!
 +# Run holds available, only the daily-hold granularity
 +
 +/openils/bin/action_trigger_runner.pl \
 +  --debug-stdout \
 +  --verbose \
 +  --run-pending \
 +  --hooks=hold.available \
 +  --granularity=Daily-Hold \
 +  --granularity-only \
 +  >/var/log/atr.log \
 +  2>/var/log/atr.log
 +
 +logger --id --tag atr "Action Trigger Runner for Daily Available Holds Done" 
 +</code>
  
evergreen-user/action_trigger.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.