Decaton supports defining a list of keys that you want to skip when processing task. The list can be dynamic. It means that you can add or remove keys from the list on the fly.
When you want to skip tasks based on their keys, you can consider using this feature.
Suppose you want to create blacklists to protect your service. For example, your service needs to analyze request logs.
You found requests from a particular IP address always sent with strange payload.
If you are using IP address as a message key then you can apply this feature to blacklist that address. The request from this IP address will be ignored.
You can use CONFIG_IGNORE_KEYS
to set list of key that you want to ignore.
Just like other properties, you can set it through SubscriptionBuilder#properties
, as shown in the following example:
...
SubscriptionBuilder.newBuilder("ignore-key-processor")
.properties(
StaticPropertySupplier.of( // (1)
Property.ofStatic(
CONFIG_IGNORE_KEYS,
Arrays.asList("key1", "key2")
)))
...
-
In this example we use
StaticPropertySupplier
to set static list. As mentioned at the very beginning, the list can be dynamic. Please refer to Dynamic property configuration for more information.