This mechanism is used to notify users about relevant changes in midPoint and/or connected resources. For example, a user (or user's boss, or the person who requested the operation, the security manager, etc) may be notified when one of user's accounts is created, modified, or removed. Or, when the midPoint user record is created, when the password is changed, or when he has a new work item to process. There are many such situations imaginable.
Currently there are the following basic kinds of notifications:
- User notifications. These are related to midPoint user record, e.g. its creation, modification or removal.
- Resource object notifications. These are related to objects on resources, e.g. creation, modification, or removal of accounts, groups, etc.
- Workflow notifications. These are generated e.g. when a work item is created or completed, or when a workflow process instance is started or finished.
- Access certification notifications. They are sent e.g. when a campaign is started, closed or about-to-be-closed, or when a response is requested from a reviewer.
- Task notifications. These are created when a task is started or finished. They are useful e.g. to notify in cases when a recurring task (like a reconciliation or live sync) ends with a failure.
- Custom notifications. These can be used for any other purposes.
Some simple examples
Configuration of notifications is currently done within SystemConfiguration object. Some examples are shown below:
General Notifier Example
A bit of theory related to event handling
When something potentially of interest occurs, an event is generated. This event is then processed by one or more event handlers, as prescribed in <notificationConfiguration> section.
There are the following kinds of event handlers.
A notifier is a module that transforms an event to zero, one or more notifications. Examples are:
Generates notifications about user records.
|simpleResourceObjectNotifier||Resource object notification||Generates notifications about resource objects (e.g. accounts).|
|userPasswordNotifier||User notification||Generates notifications about user passwords.|
|accountPasswordNotifier||Account notification||Generates notifications about account passwords.|
|simpleWorkflowNotifier||Workflow notification||Generates notifications about start/completion of work items (i.e. user tasks) and about start/completion of workflow process instances.|
|simpleCampaignNotifier, simpleCampaignStageNotifier||Certification notification||Generates notifications about certification campaigns.|
|simpleTaskNotifier||Task notification||Generates notifications about tasks.|
|generalNotifier||This is a general purpose notifier that is driven by expressions, which transform an event into a notification.|
A filter is a component that does not generate notifications, but passes through (or filters out) defined subsets of notifications. There are currently the following kinds of filters:
|category||passes one or more defined categories of events: resource object-related events ("resourceObjectEvent"), user-related events ("modelEvent"), work item-related events ("workItemEvent"), workflow-related events ("workflowProcessEvent"), or any workflow-related events ("workflowEvent" - currently this means "either workItemEvent or workflowProcessEvent")|
|status||passes or filters events based on their status: success, alsoSuccess, failure, onlyFailure, inProgress (with a bit different sets of acceptable values and their semantics for account/user/workflow events)|
|operation||passes or filters events based on the kind of operation that was executed or attempted to: add, modify, or delete|
|expression||a generic filter that evaluates an expression and passes/filters event based on the result|
|objectKind||passes or filters events based on the kind of resource object they deal with (account, entitlement, generic)|
|objectIntent||passes or filters events based on the intent of resource object they deal with|
A filter can be specified as part of a notifier - in that case it defines which classes of events get processed by that notifier. Or a filter can be a standalone part of a handler chain (see below).
Special kinds of handlers
There are two special kinds of handlers:
|Handler chain (chained)||Contains sequentially ordered event handlers (notifiers, filters, forks, other chains). Processing within a chain continues until an event is filtered out. (Please note that filtering is done only by filters; all notifiers simply pass all events along.)|
|Fork (forked)||Splits processing of an event into more handlers "in parallel". (We expect this kind of handler will be used only occassionally, however, we have implemented in for completeness.)|
We can define attachments for mail. We have two choices, adding attributes to the xml or writing of script.
Supported since midPoint 4.0.
If we use attachment, then we have two choices, insert the content to the xml or use file.
|contentType||true||Content type for the attachment, e.g. image/png or text/html.|
|content||choice||Content of the attachment.|
|contentFromFile||choice||Path of the file that provides the content for this attachment.|
File name for the attachment. E.g. in the case of the mail transport it should be put into Content-Disposition header field. If omitted and if contentFromFile is used, it is derived from the name of that file. If it omitted with used content, it's value is 'attachment'.
Executing the handlers
When an event is created, all the handlers defined at the level of <notificationConfiguration> are executed.
Some more advanced examples:
For instructions how to configure notifiers, filters, and transports please see administrator's guide.
To send HTML emails, set <contentType>text/html; charset=UTF-8</contentType> and put to <bodyExpression> escaped HTML in single quote.
These are briefly described in the Sending custom notifications HOWTO.