Monday, October 26, 2015

How to use drop mediator in WSO2 ESB

Drop mediator is used to stop the process. Once drop mediator is executed, it sends the Http 202 Accepted response to the client. No mediator will be executed written after drop mediator.


There are some scenario in programming like just stop the process and send response back to the client, drop mediator can be used.


Example:

<filter xpath="string-length(get-property('getBlogName'))='shriwithjava'">
<then> 
<send>
<endpoint>
<address uri="http://localhost:8280/services/getEpmList"/>
</endpoint>
</send>
</then>
<else>
<send/>
<drop/>
</else>
</filter>

In the above example we are trying to match the condition like is blog name is ‘shriwithjava’ then send it to get employee list service otherwise drop the message right there.

No comments:

Post a Comment