Mule esb - How to use Idempotent Filters in 5 minutes
1. Mule ESB
How to use Idempotent Filters in 5 minutes
Gennaro Spagnoli - 2016
2. In this tutorial we will be using the idempotent filter, which is a filter that ensures that only
unique messages are received by a service by checking the unique ID of the incoming
message.
As usual, let’s begin creating the http inbound component to trigger the flow
The goal is to send a query param called ‘name’, with a value based on which the flow will
continue or end after the http inbound component, if the message with that name is sent just
once.
If a message with a certain name prop is already sent, it will be discarded.
Gennaro Spagnoli - 2016
3. For this purpose we will use the ‘expression filter’ configured in the following way:
The meaning of the expression is to let the incoming messages pass through the filter only if
the expression is evaluated to true once. In this case, so, if the passed ‘name’ param value is
set to ‘Gennaro’.
Let’s add a set Payload and a logger to see the results, and show the message pass through
the filter.
Gennaro Spagnoli - 2016
4. Let’s dive into postman to test it out.
Test #1. First time Message with name= Gennaro :
Gennaro Spagnoli - 2016
Test #2. Second time Message with name= Gennaro :
Fantastic!