Skip to content

Latest commit

 

History

History
76 lines (50 loc) · 3.29 KB

File metadata and controls

76 lines (50 loc) · 3.29 KB
description
This page provides the technical details of the Interrupt policy

Interrupt

Overview

The Interrupt policy can be used to break the entire request processing in case of a condition This is defined on the policy. By default, if no policy condition is defined, the policy will always break request processing.

Breaking the request processing means that no more policies will be executed and no endpoint will be called by the gateway.

By default, the policy will return a response payload to the consumer which contains the message.

If you want to override this standard response from the policy, you can define an errorKey which will be then be used to define a Response Template.

Functional and implementation information for the Interrupt policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v2 APIs and v4 proxy APIs. It cannot be applied to v4 message APIs. {% endhint %}

{% tabs %} {% tab title="Proxy API example" %} Sample policy configuration:

"policy-interrupt": {
    "errorKey": "MY_CUSTOM_KEY",
    "message": "You got a problem, sir!",
    "variables": [{
        "name": "custom-variable",
        "value": "{#request.headers['origin']}"
    }]
}

{% endtab %} {% endtabs %}

Configuration

Phases

The phases checked below are supported by the Interrupt policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequesttrueonRequesttrue
onResponsetrueonResponsetrue
onRequestContenttrueonMessageRequestfalse
onResponseContenttrueonMessageResponsefalse

Options

The Interrupt policy can be configured with the following options:

PropertyRequiredDescriptionTypeDefault
errorKeytrueThe error Key to use for defining a Response Templatestring-
messagetrueDefault response templatestring-
variablesfalseThe variables for Response Template purposeList of variables-

Compatibility matrix

The following is the compatibility matrix for APIM and the Interrupt policy:

Plugin VersionSupported APIM versions
1.x+3.10.x+

Errors

Code Message
500 Request processing broken

Changelogs

{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-interrupt/blob/master/CHANGELOG.md" %}