Contact Free trial Login

And/Or/Not Logic Filters

MuleSoft recommends against deployments to Mule 3.8. Standard Support for this version ended on November 16, 2018, and Mule 3.8 will reach its End of Life on November 16, 2021, when Extended Support ends.

Allows filtering of messages using And/Or/Not logic expressions.

Minimum Configuration: None.

Filter Configuration

Logic filters apply the And, Or, Not logic to one or more nested filters that they enclose. When you use these logic filters, you add nested filters to them from within the nested pane for the And, Or, Not filter.

  1. In Anypoint Studio, search for "logic" and drag the Filter Reference block to the Canvas.

  2. Click the processor to open the properties editor:

    filter properties
  3. Click the green plus sign to the right of Global Reference.

  4. Click the down arrow for Filters to show the filter selections:

    filter global type
  5. Click And and OK.

  6. Click the green plus sign below And-Filter Nested:

    and filters

Use the And Filter to combine two or more filters. The And Filter accepts the message and returns true only if all of its enclosed filters return true.

The Or Filter returns true if any of its enclosed child filters return true. That is, it accepts the message if the message matches the criteria of any of its filters.

The Not Filter inverts its enclosed filter. That is, the Not Filter accepts the message and returns true if the message does not match the filter criteria. For example, if the enclosed filter normally returns true for a specific message, when nested within the Not filter it returns false.

Example Code

Code sample to create an And filter:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="" xmlns="" xmlns:doc=""
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>
    <and-filter name="And" doc:name="And">
    <flow name="add_logicFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <filter ref="And" doc:name="Filter Reference"/>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub