7 Replies Latest reply on Apr 27, 2015 2:00 PM by kcbabo

    Service domain name in Switchyard clustering

    bhaskarsk

      I have a cluster of three nodes.

      node 1 invokes service1 present on both node2 and node3. All the three nodes are running in standalone mode. ( roundrobin strategy)

      I am getting following exception

      SWITCHYARD039608: Unable to find ServiceDomain for service: {urn:com.example.sample:service:1.0}EventManager. Verify the service name and namespace are registered in the runtime.


      What does service domain regards to when nodes are running in standalone mode. If anything is required like that, how is it set?


      I tried implementing custom load balance strategy and print few log statements and fount out the domain is null.



      @Override
          public RemoteEndpoint selectEndpoint(QName serviceName) {
          System.out.println("Entry selectEndpoint" + count);
              if (getRegistry() == null) {
                  return null;
              }
              RemoteEndpoint selectedEp = null;
              List<RemoteEndpoint> eps = getRegistry().getEndpoints(serviceName);
              if (!eps.isEmpty()) {
              Properties prop=null;
              try {
              String filePath=System.getProperty("CONFIG_DIR") + File.separator + propertiesFile;
           
              InputStream settingsStream=new FileInputStream(filePath);
      
        prop=new Properties();
      
        prop.load(settingsStream);
        } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }
        String val=prop.get("cluster-nodes").toString();
        List<String> nodeList=Arrays.asList(val.split(","));
              System.out.println("Clustered nodes" + nodeList);
              boolean done=false;
              for(String node:nodeList){
              for(RemoteEndpoint remoteEndpoint:eps){
           
              System.out.println(remoteEndpoint.getNode()+" "+remoteEndpoint.getDomainName()+" "+remoteEndpoint.getServiceName());
              if(remoteEndpoint.getNode().equals(node)){
              System.out.println("selected node:" +remoteEndpoint.getNode()+" "+remoteEndpoint.getDomainName()+" "+remoteEndpoint.getServiceName());
              done=true;
              selectedEp=remoteEndpoint;
              break;
              }
              }
              if(done){
              break;
              }
           
              }
             }
            
              return selectedEp;
          }
      
      
      

       

      I see the stdout as below, domain name is always null.

       

      22:22:05,944 INFO  [stdout] (NioProcessor-30) Entry selectEndpoint1

      22:22:05,945 INFO  [stdout] (NioProcessor-30) Clustered nodes[node1/switchyard, node2/switchyard, node3/switchyard]

      22:22:05,945 INFO  [stdout] (NioProcessor-30) node2/switchyard null {urn:com.example.sample:service:1.0}EventManager

      22:22:05,945 INFO  [stdout] (NioProcessor-30) selected node:node2/switchyard null {urn:com.example.sample:service:1.0}EventManager

        • 1. Re: Service domain name in Switchyard clustering
          kcbabo

          Which version of SY are you using?

          • 2. Re: Service domain name in Switchyard clustering
            bhaskarsk

            Hi Keith

             

            I am using redhat FSW GA version 6.0.0

            switchyard version is 1.1.1-p5-redhat-1

            • 3. Re: Service domain name in Switchyard clustering
              kcbabo

              Hmm ... that's a bit strange.  The servlet receiving your cluster request will actually look up the domain name for the service based on the service name, so the fact that it's null should not be a problem (why it's null is something else to look at).  Is it possible to a get a zip of the app (or something equivalent) which can be used to reproduce?  If not, here are some other things to look at:

               

              Does the demos/cluster app work in your environment?

               

              Are you using clustered SCA bindings for the services and references in the application?  Or do you have custom code you are using to invoke the remote endpoints?

               

              You should see log entries in node1 that show it discovered the services available in node2 and node3.  Are you seeing these messages and do the service names match?

              • 4. Re: Service domain name in Switchyard clustering
                bhaskarsk

                Indeed its bit strange.

                We had the demo/cluster app working earlier.

                We used the similar approach to do the clustering in our apps and we started facing this problem. We retried executing the demo/cluster app and it is also having the same problem now.

                 

                In the logs of the EAPs, we see that all three nodes are in cluster and also the service is published in the node2 and node3.

                Node1 ( Eventadaper1)

                20:50:05,372 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-6,shared=udp) ISPN000094: Received new cluster view: [eventmanager1/switchyard|115] [eventmanager1/switchyard, aorappcl3/switchyard, eventadapter1/switchyard]


                Node2(eventmanager1)

                17:49:23,174 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-7,shared=udp) ISPN000094: Received new cluster view: [aorappcl3/switchyard|34] [eventadapter1/switchyard, eventmanager1/switchyard, aorhacore3/switchyard]


                17:47:32,126 INFO [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-5) Route: direct:{urn:com.example.sample:service:1.0}MBAEventManager started and consuming from: Endpoint[direct://%7Burn:com.example.sample:service:1.0%7DEventManager]

                17:47:32,133 INFO [org.switchyard.as7.extension.cluster.RemoteEndpointListener] (MSC service thread 1-5) Published Remote Service Endpoint /switchyard-remote

                 

                What i am not able to understand is, in the custom load balancing strategy class when we do the below

                List<RemoteEndpoint> eps = getRegistry().getEndpoints(serviceName);

                It is able to find out the remote end points which has this service published. When we try to invoke this service on this endpoint, it does validation of the endpoint details and there when it could not find serviceDomain it is throwing exception.


                • 5. Re: Service domain name in Switchyard clustering
                  kcbabo

                  If the cluster demo is failing, then that makes debugging a bit easier as it means we can use the same application as a reference.  My first recommendation would be to start with a fresh install and follow the instructions in the cluster demo README.  If that fails, then I would zip up the logs for each instance so they can be reviewed.


                  BTW, if you are using FSW 6.0, I definitely recommend filing a support ticket to help you through this issue.

                  • 6. Re: Service domain name in Switchyard clustering
                    dsouzapreethi

                    Hi Keith,

                    When nodes get clustered we are able to get logs being clustered but not the sca services being clustered.

                    Does that should appear in log as well??

                     

                    On further analysis also found that switchyard remote servlet contains endpoint of dealer service alone and not the remote credit service which are installed in two other machines.

                    It would be helpful if we get working logs for further tracing.

                    • 7. Re: Service domain name in Switchyard clustering
                      kcbabo

                      If you see the cluster view updates in the log, then the cluster members can see one another.  Logging for services registered in the distributed service registry was added in 2.0 (org.switchyard.remote logging = DEBUG), so you won't see log entries for service registrations replicated across the cluster.  The cluster demo app definitely works with FSW 6.0, so something else is going on here.  Start with a clean install of FSW on a single instance and follow the instructions in the cluster demo README exactly.  If that fails, then there is a fundamental issue in the environment that needs to be addressed.  If it's successful, then it's time to start looking at the differences between that example and your target application.  As a FSW customer, your best bet is to file a ticket with RH support so they can go through your installation details and offer advice on your specific application.