Forum Stats

  • 3,853,503 Users
  • 2,264,229 Discussions
  • 7,905,374 Comments

Discussions

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

RAMESH_A
RAMESH_A Member Posts: 89 Blue Ribbon
edited Oct 21, 2016 8:00AM in SOA Suite Discusssions

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

Martien van den Akker
«1

Answers

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,777 Bronze Crown
    edited Oct 18, 2016 4:35AM

    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

  • RAMESH_A
    RAMESH_A Member Posts: 89 Blue Ribbon
    edited Oct 18, 2016 6:09AM

    Thank you Martien...

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,777 Bronze Crown
    edited Oct 18, 2016 6:10AM

    You're welcome.

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

    Regards,
    Martien

  • AnatoliAtanasov
    AnatoliAtanasov Member Posts: 883 Silver Trophy
    edited Oct 18, 2016 10:39AM

    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.

    Martien van den Akker
  • Srinivas Y
    Srinivas Y Member Posts: 88
    edited Oct 18, 2016 11:09AM

    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.

    Martien van den Akker
  • Martien van den Akker
    Martien van den Akker Member Posts: 2,777 Bronze Crown
    edited Oct 19, 2016 5:23AM

    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

  • cdm_nagaraj
    cdm_nagaraj Member Posts: 27
    edited Oct 20, 2016 1:55AM

    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

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,777 Bronze Crown
    edited Oct 20, 2016 2:26AM

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

    Regards,
    Martien

  • cdm_nagaraj
    cdm_nagaraj Member Posts: 27
    edited Oct 20, 2016 2:45AM

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

  • AnatoliAtanasov
    AnatoliAtanasov Member Posts: 883 Silver Trophy
    edited Oct 21, 2016 5:18AM

    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.

    Martien van den Akker
This discussion has been closed.