Hi,
If we need to retrieve a Member object from the topology for a given
member id, we need to perform a 3 level iteration to look it up. This
is a limitation of current topology data structure. Following is a
sample code I had to use for this.
for (Service service : topology.getServices()) {
if (service.getClusters() != null) {
for (Cluster cluster : service.getClusters()) {
if (cluster.getMembers() != null) {
for (Member member : cluster.getMembers()) {
// we are checking faulty status only in
previously activated members
if (member != null &&
MemberStatus.Activated.equals(member.getStatus())) {
// get the member
}
}
}
}
}
}
Is there a better way to do this? If not, shall we add more efficient
APIs to retrieve these kind of information?
Thanks.
--
Akila Ravihansa Perera
Software Engineer, WSO2
Blog: http://ravihansa3000.blogspot.com