Skip to content

gravitee-io/gravitee-policy-message-filtering

Repository files navigation

Message Filtering policy

Gravitee.io License Releases CircleCI Join the community forum

Phases

onRequest onMessageRequest onResponseContent onMessageResponse

X

X

Description

You can use the message-filtering policy to filter the messages before they are propagated.

Configuration

You can configure the policy with the following options:

Property Required Description Type Default

filter

X

The filter’s rule.

string

-

Example

If my messages looks like :

{
    "productId": "1234",
    "value": "any value"
}

I will be able to filter any messages according to subscriptions metadata productId by configuring the policy as bellow :

 {
    "name": "Products filter",
    "description": "Filter messages based on subscription product id",
    "enabled": true,
    "policy": "message-filtering",
    "configuration": {
        "filter": "#jsonPath(#message.content, '$.productId') == '#subscription.metadata.productId'"
    }
}