stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imesh Gunaratne <im...@apache.org>
Subject [Discuss] Topology Filters Refined
Date Fri, 06 Mar 2015 20:17:21 GMT
Hi Devs,

I have now refined the topology filters in messaging component:


‚Äč

Each topology filter has an apply() method and it accepts a set of filter
properties:

/**
 * Returns true if member is excluded else returns false.
 * @param lbClusterId load balancer cluster id of the member
 * @param networkPartitionId network partition id of the member
 * @return
 */
public static boolean apply(String lbClusterId, String networkPartitionId) {
    boolean excluded = false;
    if(getInstance().isActive()) {
        if (StringUtils.isNotBlank(lbClusterId) &&
getInstance().lbClusterIdExcluded(lbClusterId)) {
            excluded = true;
        }
        if (StringUtils.isNotBlank(networkPartitionId) &&
getInstance().networkPartitionExcluded(networkPartitionId)) {
            excluded = true;
        }
        if (excluded && log.isDebugEnabled()) {
            log.debug(String.format("Member is excluded: [lb-cluster]
%s", lbClusterId));
        }
    }
    return excluded;
}

How to apply in a message processor:

// Apply member filter
if(TopologyMemberFilter.apply(member.getLbClusterId(),
member.getNetworkPartitionId())) {
    return false;
}


Thanks

-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Mime
View raw message