Dhivya,

There is a sample application included with the distribution, mentioned
at the end of the section on alerting in the search developers guide:

        http://developer.marklogic.com/pubs/4.1/books/search-dev-guide.pdf

Did you verify that your triggers are really being created in your
triggers database?
Did anything show up in your server's error log?

Wayne.


On Sun, 2009-10-25 at 09:07 -0700, dhivya vijayakumar wrote:

> Hi team,
> 
> 
> 
> We are exploring the Alert function of ML and we created the sample
> alert using the following code. please check the code below.
> we created the action, rule alert config and one trigger to call the
> alert. but when we load the document to the database the trigger is
> not fired. can you check whats wrong in the below code. if possible
> can some body share sample code.
> 
> 
> with regards,
> Dhivya.v
> 
> 
> CODE WE CREATED.....
> Alert Config creation:
> 
> (: run this a user with the alert-admin role :)
> 
> xquery version "1.0-ml";
> 
> import module namespace alert = "http://marklogic.com/xdmp/alert";
> 
> at "/MarkLogic/alert.xqy";
> 
> let $config := alert:make-config(
> 
> "my-alert-config-uri",
> 
> "My Alerting App",
> 
> "Alerting config for my app",
> 
> <alert:options/> )
> 
> return
> 
> alert:config-insert($config)
> 
>  
> 
> Alerting in the log file:
> 
> xdmp:log(fn:concat(xdmp:get-current-user(), " was alerted"))
> 
>  
> 
> Alert Action creationL
> 
> xquery version "1.0-ml";
> 
> import module namespace alert = "http://marklogic.com/xdmp/alert";
> 
> at "/MarkLogic/alert.xqy";
> 
> let $action := alert:make-action(
> 
> "xdmp:log",
> 
> "log to ErrorLog.txt",
> 
> xdmp:modules-database(),
> 
> xdmp:modules-root(),
> 
> "/alert-action.xqy",
> 
> <alert:options>put anything here</alert:options> )
> 
> return
> 
> alert:action-insert("my-alert-config-uri", $action)
> 
>  
> 
>  
> 
> Alert Rule creation:
> 
> xquery version "1.0-ml";
> 
> import module namespace alert = "http://marklogic.com/xdmp/alert";
> 
> at "/MarkLogic/alert.xqy";
> 
> let $rule := alert:make-rule(
> 
> "simple",
> 
> "hello world rule",
> 
> 0, (: equivalent to xdmp:user(xdmp:get-current-user()) :)
> 
> cts:word-query("hello world"),
> 
> "xdmp:log",
> 
> <alert:options/> )
> 
> return
> 
> alert:rule-insert("my-alert-config-uri", $rule)
> 
>  
> 
>  
> 
> Alert Trigger creation:
> 
> xquery version "1.0-ml";
> 
>   import module namespace alert = "http://marklogic.com/xdmp/alert"; 
> 
>                  at "/MarkLogic/alert.xqy";
> 
>  
> 
>   let $uri := " my-alert-config-uri "
> 
>   let $trigger-ids :=
> 
>     alert:create-triggers (
> 
>         $uri,
> 
>        trgr:trigger-data-event(
> 
>            trgr:directory-scope("/", "infinity"),
> 
>             trgr:document-content(("create", "modify")),
> 
>            trgr:pre-commit())))
> 
>   let $config := alert:config-get($uri)
> 
>   let $new-config := alert:config-set-trigger-ids($config,
> $trigger-ids)
> 
>   return alert:config-insert($new-config)
> 
>  
> 
> 
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to