-
Notifications
You must be signed in to change notification settings - Fork 66
Configure triggers #109
Comments
+1 on this too. Many of my demos make extensive use of triggers. Having this would simplify sharing demos and remove misconfiguration issues. |
+1 on this. We have a customer who uses roxy for dev and deploy and they are starting to implement triggers. |
Hmm, interesting. You could mimic at least part by pushing trigger xml docs into the Triggers database, but can imagine that is a bit of a hassle.. ;-) +1 |
Not yet implemented, but you can do it in deploy/app_specific.rb. Here's an example:
|
Here an example for plain triggers: class ServerConfig
alias_method :original_deploy_modules, :deploy_modules
def deploy_modules()
original_deploy_modules
r = execute_query(%Q{
xquery version "1.0-ml";
import module namespace trgr="http://marklogic.com/xdmp/triggers"
at "/MarkLogic/triggers.xqy";
xdmp:log("Installing triggers.."),
try {
trgr:remove-trigger("CreateTrigger"),
trgr:remove-trigger("ModifyTrigger")
} catch ($ignore) {
};
xquery version "1.0-ml";
import module namespace trgr="http://marklogic.com/xdmp/triggers"
at "/MarkLogic/triggers.xqy";
trgr:create-trigger("CreateTrigger", "Trigger to enrich XML ingested via MLCP",
trgr:trigger-data-event(
trgr:directory-scope("/ingest/", "1"),
trgr:document-content("create"),
trgr:pre-commit()
),
trgr:trigger-module(xdmp:modules-database(), "/", "/triggers/enrich-xml.xqy"),
fn:true(),
xdmp:default-permissions(),
fn:false()
),
trgr:create-trigger("ModifyTrigger", "Trigger to enrich XML ingested via MLCP",
trgr:trigger-data-event(
trgr:directory-scope("/ingest/", "1"),
trgr:document-content("modify"),
trgr:pre-commit()
),
trgr:trigger-module(xdmp:modules-database(), "/", "/triggers/enrich-xml.xqy"),
fn:true(),
xdmp:default-permissions(),
fn:false()
)
},
:app_name => @properties["ml.app-name"]
)
end
end |
I just added both of these samples to the Adding Custom Build Steps wiki. |
Could Richard's method be implemented as standard ? |
I would prefer going even a step further, and taking deployment of CPF as example: ml local deploy triggers
ml local clean triggers and while at it: ml local deploy alerts
ml local clean alerts The idea would be to record essential settings in some XML config, and have that interpreted and executed. The syntax could be close to the real XML syntax of triggers/alerts inside the database. I expect that to be less error prone.. A bit more involved, but will add it to the wishlist of release 1.7.3 |
+1 on adding commands for triggers and alerts |
At last!!! +1! |
Sorry guys, pushing away for the time being.. |
@adamfowleruk @peetkes @eouthwaite I implemented deploying and removing (cleaning) triggers. Testers welcome. |
If this approach looks good, alerts could be added to the same file (triggers-config.xml) or to a file that is specific to alerts. |
By calling functions, mistakes in the configuration XML will trigger more specific errors.
Added a wiki describing the new feature (currently in a PR). |
…rs-config file to deploy directory
fixed in dev |
Figure out a good way to include triggers in the deploy process and implement it.
The text was updated successfully, but these errors were encountered: