12 Replies Latest reply on Oct 21, 2016 12:00 PM by Martien van den Akker

    Is it possible to know which soa server is processing the Instance

    RAMESH_A

      Hi All,

       

      We have 3 soa severs in a cluster.

       

      Please let me now, if it is possible to know which soa server is processing the particular instance. Does the DB is having these information?

       

      Thank you,

      Ramesh

        • 1. Re: Is it possible to know which soa server is processing the Instance
          Martien van den Akker

          Hi,

          No, it's not particularly possible. You could maybe do something using Java/JMX from an embedded java activity. But keep in mind that after activities like wait, receive, etc. a dehydration is done. And then after the incoming event, another server could pick it up and process it further. So especially for longer running processes it's not 'deteriminable' which other server it's going to be.

           

          I wouldn't rely on it. The whole idea of SOA Suite (already from BPEL 10g onwards, and I think earlier) that it should be transparent and not important which server does what. BPEL 'loadbalances' or clusters through the dehydration-store. So they work together natively.

           

          Regards,
          Martien

          • 3. Re: Is it possible to know which soa server is processing the Instance
            Martien van den Akker

            You're welcome.

            Would appreciate it to have the question answered/marked helpful...

             

            Regards,
            Martien

            • 4. Re: Is it possible to know which soa server is processing the Instance
              AnatoliAtanasov

              Hi there Ramesh_A,

               

              here are my two cents on the topic:

              1) you could use ora:getProcessURL() built-in function to get the URL of WebService SOAP endpoint URL of the composite application. As you are in a clustered environment it might turn that the function returns the same result on all servers (depending on your setup). But the cost of PoC is minimal.

               

              2) you could create a custom XPath function that uses Java to determine the hostname of the server that currently processes your instance. You could use Java activity with this code - Getting the computer name in Java - Stack Overflow, but I prefer using XPath functions instead of Java embedding in BPEL.

               

              HTH,

              A.

              • 5. Re: Is it possible to know which soa server is processing the Instance
                Srinivas Y

                Hello Ramesh

                 

                I am not sure if i got the question correctly but if you want to know in which node an instance has been executed you could get that from Dehydration database.

                 

                Below mentioned is the query for same

                 

                select create_cluster_node_id from cube_instance where cmpst_id='Composite Instance ID of the instance for which you wish to know the node on which its executed'

                 

                Regards

                Srinivas.

                • 6. Re: Is it possible to know which soa server is processing the Instance
                  Martien van den Akker

                  Nice! I looked into the suggestion of Anatoli and couldn't help trying it. Based on the suggestion I created the following bean:

                  package nl.darwinit.soasuite; import java.net.InetAddress; import java.net.UnknownHostException;   public class ServerHostBeanImpl implements IServerHostBean {     public ServerHostBeanImpl() {         super();     }          public  String getHostName(String hostNameDefault){         String hostName;         try         {             InetAddress addr;             addr = InetAddress.getLocalHost();             hostName = addr.getHostName();         }         catch (UnknownHostException ex)         {             System.out.println("Hostname can not be resolved");             hostName = hostNameDefault;         }         return hostName;     }      }

                  Then I created the following interface:

                  package nl.darwinit.soasuite;  public interface IServerHostBean {     String getHostName(String hostNameDefault); }

                  Then in a project I am working on, I added a spring context (see also my article Darwin-IT: Forget about WSIF: welcome Spring . By the way, in contrast to my suggestions in the article, you don't have to create a springcontext for every bean.)

                  The spring context, getHostNameContext, has the following content:

                  <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util"        xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"        xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"        xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://xmlns.oracle.com/weblogic/weblogic-sca META-INF/weblogic-sca.xsd">     <!--Spring Bean definitions go here-->     <sca:service name="GetHostService" target="ServerHostBeanImpl" type="nl.darwinit.soasuite.IServerHostBean"/>     <bean id="ServerHostBeanImpl" class="nl.darwinit.soasuite.ServerHostBeanImpl"/> </beans>

                  So my composite looks like:

                  getHostNameContext.png

                  The Spring Context can be wired to the bpel, and in the BPEL process I added a scope with an invoke to the generated partnerlink.

                  Running it results in:

                  InvokeGetHostName.png

                   

                  The scope can be converted to an (inline or reusable) subprocess, so that you can reuse it.

                   

                  Of course you can add the java code in an embedded java-activity. But this makes it a little more pluggable.

                   

                  Regards,
                  Martien

                  • 7. Re: Is it possible to know which soa server is processing the Instance
                    cdm_nagaraj

                    Hello,

                     

                    This Query did help me in 11g. 

                     

                    select c.cikey as bpel_id, n.ip_address
                    from cube_instance c
                    left join cluster_node n
                    on c.last_cluster_node_id = n.node_id

                    where c.cikey = <BPELINSTANCEIDFROMEMCONSOLE>'20002';

                     

                    HTH.

                     

                    THanks

                    • 8. Re: Is it possible to know which soa server is processing the Instance
                      Martien van den Akker

                      Yeah, but that's only after a dehydration. Not when it's currently running.

                       

                      Regards,
                      Martien

                      • 9. Re: Is it possible to know which soa server is processing the Instance
                        cdm_nagaraj

                        Yes Martien, since the query was asked in database, i assumed that way. You are right. Can we trace this using ECID ??

                        • 10. Re: Is it possible to know which soa server is processing the Instance
                          AnatoliAtanasov

                          Hi there Martien,

                           

                          I also kind of hate the Java activity as it brings issues when you build/package with Maven. For this kind of low level operations I prefer to create custom XPath functions and use them in assign, XSL transformations etc. and I also believe that it is by faster as the "messages" does not go through the fabric.

                           

                          Cheers,

                          A.

                          • 11. Re: Is it possible to know which soa server is processing the Instance
                            AnatoliAtanasov

                            Hi there,

                            I think you should be able to run that query with ECID as where clause parameter. You would need to examine the COMPOSITE_* and CUBE_* tables thoroughly. It is actually quite easy to establish the logical connections/relations between the tables, though explicit foreign keys are missing. AFAIR ECID is used across the most important tables or at least you are able to such joins to reach the desired data based on the parameters you are interested in.

                             

                            Actually, just checked  - in the CUBE_INSTANCE you have ECID column.

                             

                            HTH,

                            A.

                            • 12. Re: Is it possible to know which soa server is processing the Instance
                              Martien van den Akker

                              Hi Anatoli,

                               

                              Yes, you're right, I agree. Especially when you need this more often. I think this use case is not a school-example for using a spring component.

                              However, I haven't created an xpath function for SOA yet. I did for OSB. Should not be that hard, but this was simpeler, easier to deploy.

                               

                              And actually I'm still curious why you want to know which server executed (a certain piece of) the flow. I can only think of finding logs in the server.logs. But could do that via EM log search.

                               

                              Regards,
                              Martien