Skip to end of metadata
Go to start of metadata

Notifications are used to send information about events that occur within midPoint. They can be related to (e.g.)

  1. model: like adding, modifying or deleting a user,
  2. resource objects: like adding, modifying or deleting an account,
  3. workflows: like starting or completing work item or process,
  4. certifications: like opening or closing a campaign,
  5. tasks: e.g. when a task is starting or finishing.

Besides these, midPoint has a special kind of event: custom events. These can be used to send "any other" notifications, not covered by the above types.

A custom event has the following attributes:

AttributeMeaning
subtypeFree-text information about category (type) of this custom event. For example, "passwordResetRequest" (if used for self-service functionality).
operationAdd / modify / delete - if relevant for a given type of custom events.
statusSuccess / alsoSuccess / failure / onlyFailure / inProgress - if relevant for a given type of custom events.
objectObject to which is given event related. It can be a PrismObject or any other object (Item, PrismValue, plain Java object, or even a collection of objects).
adHocHandlerEvent handler that should be used to process this event.

These custom events can be processed in one or both of the following ways:

  1. Using standard notification configuration in system configuration object. I.e. they might be filtered and eventually translated into messages using a notifier. Because no out-of-the-box notifier exists for custom events, a generalNotifier has to be used. This notifier has to specify the recipient(s), subject, and body of created message.
  2. Using ad-hoc event handler, specified within the event itself. Definition of this handler is exactly the same as definition of handlers in system configuration.

When a custom event is processed, first the ad-hoc handler is used (if present), followed by handler(s) from the system configuration object.

How to submit custom events

Using bulk actions

In order to easily send custom events there is the notify scripting (bulk) action. It takes the input from the pipe - usually a list of PrismObjects - and creates an event for each one of them. (Alternatively, for the whole list, if forWholeInput parameter is set to "true".)

The following parameters are available:

ParameterMeaning
subtypeSubtype of the event created.
operationOperation to be put into event (add, modify, delete). Default is "add".
statusStatus to be put into event (success, failure, inProgress, alsoSuccess, onlyFailure). Default is "success".
handlerAd-hoc event handler that should be used to process the event.
forWholeInputWhole input (i.e. all items in the pipeline) should be sent as event object. The default behavior is to generate one event for each input object.

All of them are optional.

An example of such bulk action:

More examples can be found in samples and tests (here and here; see also related system configuration).

These bulk actions can be also generated by the Eclipse plugin, since 0.10.3.

Using Java code

Constructing and submitting custom events is simple; like this:

Just have a look at NotifyExecutor Java class (implementing "notify" bulk action).

 

  • No labels