You can use the message-filtering
policy to filter the messages before they are propagated.
You can configure the policy with the following options:
Property | Required | Description | Type | Default |
---|---|---|---|---|
filter |
X |
The filter’s rule. |
string |
- |
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'"
}
}