Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Mule ESB: Creating Custom Fliter

0.00/5 (No votes)
29 Aug 2016 1  
Mule ESB: Creating Custom Fliter

In this tip, I will show you how to create a very simple Custom Filter inside your Mule flow.

At first, you need to create a Java class implementing the org.mule.api.routing.filter.Filter, you have to override the accept() method. Check out the below sample filter which can be used to Filter out Input Streams java.io.InputStream.

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;
    }
}

Provide this class in Custom Filter component from the palette.

Your custom filter is now ready to use!

<custom-filter class="org.rahul.mule.filter.InputStreamFilter" doc:name="Streamable Filter">
      </custom-filter>

I hope this helps!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here