Skip to main content

filter_callback

Creates a wrapper function that executes the provided callback only if the task specified in the message body is present in the allowed tasks list.

def filter_callback(
callback: function,
tasks: list
) - > function

Wraps a callback function to only execute if the incoming message's task name matches a specified whitelist.

Parameters​

NameTypeDescription
callbackfunctionThe original message handler function to be executed if the task filter passes.
taskslistA collection of allowed task names used to filter incoming message bodies.

Returns​

TypeDescription
functionA decorated version of the original callback that performs task-based filtering before execution.