Filtering a Message icon

Filtering a Message

(0 reviews)

home

Shows how to use filter components within Anypoint Studio to filter an incoming message.

Example

This example application receives an order in JSON format for filtering. It employs AND, Message property, Payload, and Custom filters to validate 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.
  2. Send a POST request with the following JSON in the body to http:/localhost:8081.

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

     The discount was granted.

Documentation

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

Reviews

TypeExample
OrganizationMulesoft Inc.
Published by
MuleSoft Organization
Published onMar 17, 2018
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0