Contact Free trial Login

Anypoint Exchange

Home to the complete listing of connectors, templates, examples and APIs.
Discover and use proven assets built by the MuleSoft ecosystem, or add assets to a private
tenant of Anypoint Exchange for collaboration and sharing of internal best practices.

Filtering a Message

Filtering a Message

(0 reviews)

Learn how to use filter components to filter an incoming message.

Screenshot of the main flow in Anypoint Studio, view full image here


This example shows how to use filter components within Anypoint Studio to filter an incoming message.

Example Use Case

This example application receives the order in JSON format for filtering. It employs And, Message property, Payload and Custom filters to validate some order properties. The Message property filter filters out messages based on whether they are HTTP POSTs or not while the Payload filter filters messages that are of the data type: ContentLengthInputStream. The AND filter combines the Message Property filter and the Payload filter and allows only those messages that satisfy both the conditions to pass by. The Custom filter uses a JAVA class to filter order messages that meet a specific criteria.

Set Up and Run the Example

Complete the following procedure to create, then run this example in your own instance of Anypoint Studio. Skip ahead to the next section if you prefer to simply examine this example.

1.Create the example application in Anypoint Studio and run it as Mule Application.
1. Send a POST request with the following JSON in the body to http:/localhost:8081.

     "purchases": 2000,
     "months": 12,
     "membership": "free"
  1. Examine the response body to see that a customer was granted a discount.

     the discount was granted.


Read full documentation in GitHub

Examples to Try Next

If you understood this example
Mule Expression Language Basics - An introduction to most of the basic implementations of Mule Expression Language.View
If you struggled with this example
HTTP Request Response with Logger - Learn how to use Mule to build a simple HTTP request-response application.View


Log into Anypoint Platform to download this asset


Created by
MuleSoft Organization
Published onJun 22, 2017


VersionRuntime version
Show more