You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Chamila De Alwis <ch...@wso2.com> on 2014/11/14 19:15:11 UTC

Getting the service name a particular memberId belongs to in Topology

Hi,

Is there a direct way of doing $subject other than iterating through all
the services from topology.getServices()?

Service memberService = null;
for (Service service: topology.getServices()){
    Cluster cluster = service.getCluster(clusterId);
    if (cluster != null) {
        if (cluster.getMember(memberId) != null){
            memberService = service;
            break;
        }
    }}



Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: Getting the service name a particular memberId belongs to in Topology

Posted by Udara Liyanage <ud...@wso2.com>.
Hi Chamila,

Topology is structured in Service - > Cluster -> Member way. That is why it
has to iterate services in order to get members.


On Sat, Nov 15, 2014 at 11:57 AM, Imesh Gunaratne <im...@apache.org> wrote:

> We could introduce a map to handle this.
>
> On Fri, Nov 14, 2014 at 11:45 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> Hi,
>>
>> Is there a direct way of doing $subject other than iterating through all
>> the services from topology.getServices()?
>>
>> Service memberService = null;
>> for (Service service: topology.getServices()){
>>     Cluster cluster = service.getCluster(clusterId);
>>     if (cluster != null) {
>>         if (cluster.getMember(memberId) != null){
>>             memberService = service;
>>             break;
>>         }
>>     }}
>>
>>
>>
>> Regards,
>> Chamila de Alwis
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Re: Getting the service name a particular memberId belongs to in Topology

Posted by Imesh Gunaratne <im...@apache.org>.
We could introduce a map to handle this.

On Fri, Nov 14, 2014 at 11:45 PM, Chamila De Alwis <ch...@wso2.com>
wrote:

> Hi,
>
> Is there a direct way of doing $subject other than iterating through all
> the services from topology.getServices()?
>
> Service memberService = null;
> for (Service service: topology.getServices()){
>     Cluster cluster = service.getCluster(clusterId);
>     if (cluster != null) {
>         if (cluster.getMember(memberId) != null){
>             memberService = service;
>             break;
>         }
>     }}
>
>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos