2. Custom Filter
Create your own Filter implementation by
Implementing org.mule.api.routing.filter interface
Overriding the standard implementations of org.mule.api.routing.filter like
org.mule.routing.filters.ExpressionFilter (used in Expression Filter component),
org.mule.routing.filters.PayloadTypeFilter (used in Payload filter component) and many
mores
3. Snippet for Custom Filter
package org.rahul.mule.filter;
import org.mule.api.MuleMessage;
import org.mule.api.routing.filter.Filter;
public class InputStreamFilter implements Filter{
@Override
public boolean accept(MuleMessage message) {
Object obj = message.getPayload();
/* Return Payload is a Stream or not*/
return obj instanceof java.io.InputStream;
}
}
4. Snippet for Custom Filter
The snippet shown will create a Filter which will allow only Streamable
payload to pass through i.e. of type java.io.InputStream
5. Configuration
Provide this class in Custom Filter component from the palette.
<custom-filter class="org.rahul.mule.filter.InputStreamFilter"
doc:name="Streamable Filter">
</custom-filter>
Your custom filter is now ready to use!