About Policy Packaging, Scope, and Size (Nov 2017)

A policy consists of the following things:

  • A YAML file

    Defines the configurable parameters of the policy. Rendered by the UI to display the input of the policy.

  • An XML template

    Contains the implementation of the policy.

  • The template’s POM

    Defines policy dependencies. Packaging type needs to be mule-policy.

  • Resources

    Optionally if the policy depends on other resources, such as a certificate, define resources as part of the policy.

  • The mule-artifact.json descriptor.

    Specify the classifier as mule-policy.

For more information, see the header policy.

Policy Scope

Policies are isolated from the application and other policies, however there are ways to expose information from a policy. The authentication information about a policy can be propagated in the Security Context Principal object.

Headers are not propagated by default. If a policy is expected to forward headers, the implementation needs to be explicit about it. Out of the box policies provide a configurable option to propagate headers.

A policy can modify message content. A policy can stop the execution flow.

Variables set on a policy have only the scope of the policy.

Policy Size

The size of a policy varies based on its dependencies. The first time Mule Runtime polls for policies it will take longer to fetch them. However, after policies are retrieved, they are cached on the file system. This ensures offline availability and also reduces latency to fetch policies.