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

Reply via email to