Loading TOC...

alert:make-action

alert:make-action(
   $name as xs:string,
   $description as xs:string,
   $module-db as xs:unsignedLong,
   $module-root as xs:string,
   $module as xs:string,
   $options as element(alert:options)
) as element(alert:action)

Summary

This function creates the specified action. When a rule associated with the action matches a document, the action's module will be invoked with the following external variables set:

declare variable $alert:config-uri as xs:string external;
declare variable $alert:doc as node() external;
declare variable $alert:rule as element(alert:rule) external;
declare variable $alert:action as element(alert:action) external;

All actions must accept these external variables.

Parameters
name The name give to the action.
description A text description of the action.
module-db The database ID where the XQuery modules reside. Use xdmp:module-database() to specify the configured database.
module-root The path to the module root. Use xdmp:module-root() to specify the configured root.
module The URI of the module to invoke.
$options Optional information specific to the action.

Example

  xquery version "1.0-ml";
  import module namespace alert = "http://marklogic.com/xdmp/alert" 
		  at "/MarkLogic/alert.xqy";

  alert:make-action(
    "sms",
    "Sends basic SMS text message",
    xdmp:modules-database(),
    xdmp:modules-root(),
    "/modules/sms.xqy",
    <alert:options>
        <provider name="T-Mobile" domain="tmomail.net"/>
        <provider name="Virgin" domain="vmobl.com"/>
        <provider name="Cingular" domain="cingularme.com"/>
        <provider name="Sprint" domain="messaging.sprintpcs.com"/>
        <provider name="Verizon" domain="vtext.com"/>
        <provider name="Nextel" domain="messaging-nextel.com"/>
    </alert:options>
  )
  => Returns the XML representing an action with the specified information

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.