description |
---|
This page provides the technical details of the Interrupt policy |
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:
{% hint style="warning" %} This policy can be applied to v2 APIs and v4 HTTP proxy APIs. It cannot be applied to v4 message APIs or v4 TCP proxy APIs. {% endhint %}
{% tabs %} {% tab title="HTTP 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 %}
The phases checked below are supported by the Interrupt
policy:
v2 Phases | Compatible? | v4 Phases | Compatible? |
---|---|---|---|
onRequest | true | onRequest | true |
onResponse | true | onResponse | true |
onRequestContent | true | onMessageRequest | false |
onResponseContent | true | onMessageResponse | false |
The Interrupt
policy can be configured with the following options:
Property | Required | Description | Type | Default |
---|---|---|---|---|
errorKey | true | The error Key to use for defining a Response Template | string | - |
message | true | Default response template | string | - |
variables | false | The variables for Response Template purpose | List of variables | - |
The following is the compatibility matrix for APIM and the Interrupt
policy:
Plugin Version | Supported APIM versions |
---|---|
1.x+ | 3.10.x+ |
Code | Message |
---|---|
500 |
Request processing broken |
{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-interrupt/blob/master/CHANGELOG.md" %}