In a high-volume environment, it is not easy to go and find a particular composite instance which processed a particular Order Id. We will see in this blog two ways in which we can locate a particular composite instance in Enterprise Manager. To locate a composite instance using wild card search see Wild Card Search post.
Enterprise manager allows instances to be searched based on “Name” field. So, populating “Name” field with Order Id is one way in which we can locate instances. In 11g, setCompositeInstanceTitle did the job. However, in 12c, we need to use setFlowInstanceTitle to set the “Name” field in EM.
Let us create a sample SOA application. Following is a sample Order Schema.
<?xml version="1.0" encoding="windows-1252" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org" elementFormDefault="qualified"> <xsd:element name="Orders" type="OrdersType"/> <xsd:complexType name="OrdersType"> <xsd:sequence> <xsd:element name="Order" type="OrderType"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="OrderType"> <xsd:sequence> <xsd:element name="OrderId" type="xsd:string"/> <xsd:element name="Orderdate" type="xsd:dateTime" minOccurs="0" /> <xsd:element name="CustId" type="xsd:string"/> <xsd:element name="Lines" type="LinesType" minOccurs="0" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="LinesType"> <xsd:sequence> <xsd:element name="lines" type="linetype" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="linetype"> <xsd:sequence> <xsd:element name="productid" type="xsd:string"/> <xsd:element name="quantity" type="xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
Create a SOA Project with a BPEL Component. Select Input as “Orders” element.
Create a dummy string variable in bpel process. This will be used in assignment statement.
Add an “Assign” activity and assign output of setFlowInstanceTitle to dummy string variable. Check “Method not found – SetFlowInstanceTitle” post, if JDeveloper shows warning for setFlowInstanceTitle function.
Deploy the project and run few tests with different order id, customer id as input. Order Id and customer id are the mandatory fields. Instances in EM console should have the value of OrderId in “Name” field.
Click on “Search Icon” and click “Add/Remove filters”. Select “FlowInstance” check box. This will add few more fields based on which search can be carried out.
Search/Locate Instances by giving values of OrderId in “InstanceName” field.
Search results will show the specific composite instance which processed given order id.
Above method of setting the “InstanceName” and searching by “InstanceName” in EM will help in identifying the specific instance.
Apart from finding by Order Id, if we need additional fields based on which instances has to be located (like by Customer Id), we can use “Composite Sensors”. EM Console allows up to 6 Composite sensors to be used as search fields in locating the instances.
Let us see how to create a composite sensor and use that to search instances.
In JDeveloper, right click on “Service Entry Point” and select “Configure Sensors”.
Click plus icon to add a sensor. Provide a Name to the sensor.
In “Expressions”, select “Variables” and select “CustId”.
Redeploy your project. Sensors will be activated only for new instances. So, make few more tests with different order id and customer id. In the “Flow Trace” , composite sensors will be listed in “Composite Sensor Values” tab.
Go to Search options and search by Sensor name and Sensor value. Select “Sensor Name” from the lookup or we can type it in the box. By default “Equal” operator is used. For further option, click on lookup icon. Search results will show specific composite instance or list of composites instances which satisfies the given customer id.
Based on requirement we can create additional composite sensors to locate instances in EM Console. If we have more than one composite sensors in search criteria, logical AND is applied to the condition in locating instances.