idempotent filter with simple file

10
Idempotent Filter with Simple-file

Upload: sunil-komarapu

Post on 27-Jan-2017

336 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Idempotent filter with simple file

Idempotent Filter with Simple-file

Page 2: Idempotent filter with simple file

Idempotent Filter is an important message filter in Mule platform which ensures that only unique messages are received by a service by checking the unique ID of the incoming message.We use Idempotent Filter to avoid any duplicate message in our Mule flow

We will be demonstrating a simple example of Idempotent Filter using simple-text-file-store.

Page 3: Idempotent filter with simple file

Idempotent Filter with simple-text-file-store :-

We can configure it following way :-

Here you can see that we have configured our Idempotent Filter with simple-text-file-store. So, now this filter will restrict any duplicates message it finds.simple-text-file-store technique will store all the messages in file and will check the file to detect duplicates whenever it receive a input message. For each message the files will be generated.

Page 4: Idempotent filter with simple file

You will see that we will run our Mule application it will generate text file in our Mule application where it will store all the message with ID to avoid the duplicate :-

Page 5: Idempotent filter with simple file

Now, we can configure with any of the options shown here, we will get following Mule flow :-

Page 6: Idempotent filter with simple file

Our Mule Config will be :-

Page 7: Idempotent filter with simple file

So, we will test our application by hitting the following url http://localhost:8081/path/test for the first time we will get :-

For the first time we will see browser display “passed” as the message payload is new and unique (path/test is the message payload here)

Page 8: Idempotent filter with simple file

And then if we hit the same url http://localhost:8081/path/test again, will get the following :-

For the second time we will see browser display “EXCEPTION” as the message payload is now same and duplicate (path/test is the message payload here)

Page 9: Idempotent filter with simple file

Hope I am able to make it clear on how to implement Idempotent Filter with different ways and you can now try by your own and experiment with this powerful filter of Mule.Hope you enjoyed this simpler version

Page 10: Idempotent filter with simple file

Thank You