Archive for May, 2015

SOA 12c–Creating ESS Schedule metadata

The real strength of ESS comes from the ability of scheduling a job which is a common use case. ESS provides Schedule as the job metadata to enable the user to schedule job either based on recurrence or on explicit dates. In this post, we will see how to create this Schedule metadata and use it for our ESS job created in the previous post.

To create Schedule metadata, select File –> New –> Enterprise Scheduler Metadata –> Schedule.

newsch1

Give a meaningful name for the schedule and use the same package as used in previous post.

newsch2

Click OK and you can observe the new schedule in project explorer.

schprojexplore

Let us define a schedule so that ESS job runs for every 2 min thrice considering Start and End dates as shown below. You can also give explicit dates to be included regardless of recurring settings in the respective section. Observe that we are not specifying any ESS job while defining the schedule which enables the reuse of schedule and can be used for any ESS jobs.

newsch3

Now save your changes and deploy to ESS server using the steps mentioned in previous post.

To view the newly created Schedule in EM console, navigate to ESSAPP –> Job Requests –> Define Schedule and do search for EssNativeHostingApp as shown below.

emnewsch3

You can also set the recurrence settings using Every field for seconds, Hours, Days, Weeks etc.. as shown below.

recurr

And appropriate selection of days, weeks etc.. will be enabled based on the selected frequency as shown below.

recurr1

Navigate to ESSAPP –> Job Requests –> Submit Job Request and select the job definition as shown below. Go to Schedule section and click search icon for Use existing schedule.

jobsubmission

Select the appropriate schedule and click OK.

selectschedule

schsubmission2

To see submitted requests, navigate to ESSAPP->Job Requests –> Search Job Requests and do search for this job.

searchjobreq

In the above screenshot, you can observe 3 requests (used 3 as the count in Schedule) have been submitted as child jobs. Click on Parent ID and Request ID to see more information on these job requests.

parentreq

childreq

Using EM Console to Create Schedule

We can also create a schedule using EM console directly as shown below.

emnewsch

emnewsch1

emnewsch2

emnewsch3

Advertisement

SOA 12c–Creating ESS Job metadata (JDeveloper)

In the previous post, We have seen how to use EM Console to create the Job metadata. This did not provide the much information about development and deployment details of ESS application. So in this post, we will use JDeveloper to create ESS Job metadata to call the Service Bus proxy services however the steps remain same for BPEL services too.

Before proceeding with actual creation of job metadata, we will know the terms Hosting and Client Applications.

Hosting Application

ESS Jobs always execute in context of hosting application. When we configure domain for ESS, we get EssNativeHostingApp which is pre-deployed native hosting application that is well suited for custom remote jobs like EJB and web service jobs. However, we can’t execute custom Java jobs.

Client Application

Client applications are typically J2EE application used to submit jobs, query job status and optionally perform updates to ESS metadata. We cannot add ESS job metadata (using MAR archive) directly to the pre-deployed native hosting application and have to deploy through a client application or using metadata API.

More information can be found in ESS documentation here

Creating ESS Application

Select File –> New –> Applications –> Custom Application as shown below.

essappl

Enter Application Name.

essappl1

Choose the Project Features as shown below and click Next.

essproj

essproj1

Choose the EJB Version and select Generate ejb-jar.xml as shown below.

essproj2

Enter a meaningful value for Application Id.

essproj3

Click Finish and verify that following files got generated in project.

essappl2

Creating Job Metadata – Job Definition

Create Job Definition following the screenshots below. Select File-> New –> Enterprise Scheduler Metadata –> Job Definition.

jobdefn

Enter Job name. Since we are going to call a OSB Synchronous service select the corresponding Job type as shown below. Make sure that location includes essmeta directory.

osbtype

Note that MW_HOME env variable has to be set as shown below to be able to see and select Job Type.

envvar

Click Web service icon to select the WSDL.

osbjobdefn

Select Service Bus as web service type and click search icon.

wsdlsel

Enter Service Bus Proxy Service WSDL as shown below and click OK. Make sure that you give the URL of concrete WSDL.

wsdlurl

Verify that Service and Port Type are automatically populated. Select the operation and parameterize payload using ESS_REQ as shown below. This context is used to access ESS Parameters defined for Job. Hence we need to create CustomerId parameter. Click OK.

wsdlsel1

Verify that System Properties are populated as shown below.

jobdefnafterwsdl

Click + in Application Defined Properties section and add CustomerId parameter as shown below and click OK.

argument1

Since our job should run in context of the pre-deployed hosting application EssNativeHostingApp, add parameter SYS_effectiveApplciation in System Properties section as shown below.

sysprop

weblogic-application.xml

Make sure you only have the following library references in this file.

<listener>
   <listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>
</listener>

<library-ref> 
   <library-name>oracle.ess.thin.client</library-name>
</library-ref>
 

ejb-jar.xml

Add following contents in this file (See the Observations section below).

<enterprise-beans>
    <session>
        <description>Runtime Session Bean</description>
        <ejb-name>RuntimeServiceBean</ejb-name>
        <ejb-class>oracle.as.scheduler.ejb.RuntimeServiceBean</ejb-class>
    </session>
    <session>
        <description>Metadata Session Bean</description>
        <ejb-name>MetadataServiceBean</ejb-name>
        <ejb-class>oracle.as.scheduler.ejb.MetadataServiceBean</ejb-class>
    </session>
    <session>
        <description>Async Request Bean</description>
        <ejb-name>AsyncRequestBean</ejb-name>
        <ejb-class>oracle.as.scheduler.ejb.AsyncRequestBean</ejb-class>
    </session>
</enterprise-beans>

adf-config.xml

If the EAR file generated from this application is to be deployed, certain MDS partition entries must be specified in this file, so add the following contents. The data source referenced here is automatically created when we configure the domain to include ESS. The namespace mentioned over here (highlighted below) should match the package structure we used for creating job definition.

<adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
    <mds-config version="11.1.1.000" xmlns="
http://xmlns.oracle.com/mds/config">
        <persistence-config>
            <metadata-namespaces>
                <namespace path="/oracle/apps/ess/custom/osb" metadata-store-usage="ess_custom_metadata"/>
            </metadata-namespaces>
            <metadata-store-usages>
                <metadata-store-usage id="ess_custom_metadata" deploy-target="true" default-cust-store="false">
                    <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
                        <property name="jndi-datasource" value="jdbc/mds-ESS_MDS_DS"/>
                        <property name="repository-name" value="mds-ESS_MDS_DS"/>
                        <property name="partition-name" value="essUserMetadata"/>
                    </metadata-store>
                </metadata-store-usage>
            </metadata-store-usages>
        </persistence-config>
    </mds-config>
</adf-mds-config>

Deployment

We have to create the following deployment profiles to be able to deploy:

  • Project level EJB JAR deployment profile.
  • Application level MAR deployment profile.
  • Application level EAR deployment profile

EJB JAR Deployment Profile

Use the following screen shots to create project level EJB JAR profile.

ejbjar1

ejbjar2

ejbsource

ejbjar3

ejbjar4

MAR Deployment Profile

Use the following screen shots to create application level MAR profile.

mar1

marcontent

maressmeta

maressmeta1

maressmeta2

EAR Deployment Profile

Use the following screen shots to create application level EAR profile.

earprofile

earprofile1

earmanifest

earlib

Deployment

Deploy the EAR file of ESS application as shown in following screenshots.

deployess1

deployess2

deployess3

deployess4

deployess5

Here, essUserMetadata is partition used by EssNativeHostingApp. We can observe deployment log as shown below.

deploylog

Submitting the request

In EM Console, navigate to Scheduling Services –> ESSAPP-> Job Requests –> Submit Job Request. Select application as EssNativeHostingApp and choose the job definition as below and select OK.

jobdefnsub

jobdefnsub1

Once the job run is successful, you can see the status as shown below.

reqsuccess

The sample application can be downloaded from here.

Observations

  • Though we add only ESS Job Support and ESS Client Support features during application creation, we see ESS Host Support as well in Project feature section as shown below.

projfeatures

  • Unable to see the Job definitions in ESS while submitting requests, when used package structure (which is effectively a namespace) that does not contain /oracle/apps/ess. Section 1.2.10 of this documentation clearly mentioning that the  job definition must be created in  the namespace /oracle/apps/ess/custom.
  • Unable to refer the WSDL from SOA_MDS or File System in the Web Service chooser during Job definition creation and is resulting into the following error as shown below.

mdswsdl

mdswsdl1

  • The data source mds-ESS_MDS_DS is to be  targeted to AdminServer as shown below, so that we will be able to select data source during deployment.

    essds

  • Initially thought, there is no need of ejb-jar.xml in this ESS application as it’s used predominantly to specify Application Name. But was getting following error during deployment when this file is not present in application or the file has empty contents. So at minimum, this file should have the contents as mentioned above.

         <May 19, 2015 8:47:48 PM IST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "Ear_EssSampleAppl" due  to error weblogic.management.DeploymentException: Error parsing META-INF/application.xml weblogic.management.DeploymentException: Error parsing META-INF/application.xml

SOA 12c–Creating ESS Job metadata (EM Console)

In this post, We will use the EM Console to create ESS Job metadata  to call the Service Bus proxy services however the steps remain same for calling BPEL service too.

Configuration

During domain creation, we should select the following options to create ESS Managed Server and EM Plugin for ESS. EM Plugin for ESS enable us to monitor and manage submitted ESS jobs.

essemplugin

You should see the EM Console as shown below on successful domain creation and starting the Admin and ESS servers. Observe that Scheduling Services is shown having ESSAPP.

emwithessapp

If you don’t select EM plugin for ESS option during domain creation, your EM console will look like below with no Scheduling Services.

emwithoutess

You can do ESS health check using >:>/ess">>:>/ess">>:>/ess">http://<<hostname>>:<<port>>/ess which brings up the following screen.

esshealth

Click Check Health for this ESS Server which submits a sample job and give us back the status of ESS server as shown below.

esshealth1

You can verify status of this sample job from Search Job Requests as shown below. The navigation to this page is given later in this post.

esshealthcheck

You can find more information inn ESS documentation here.

Creating Job Definition

First, we need to create Job Metadata so that we can execute the ESS job or schedule as and when required. Job Definition contains all required metadata to run the job. We can use JDevloper or EM Console to create job definition. In this post, we will demonstrate usin EM Console.

Right click on ESSAPP and select Job Definitions as shown below.

emjobdefn

Click Create to proceed with creation of new ESS Job Definition.

emjobdefncreate

Provide Job name and other information as shown below. We need to select Job Type as SyncWebserviceJobType as we want to call a service bus Proxy Service. Click Select Web Service to select the WSDL of service.

emsyncws

Provide WSDL URL and choose Web Service Type as Service Bus. Click OK.

emjobdefnwsdl

Observe that the services listed in WSDL are shown. Select the Port Type and Operation as required which shows up the sample payload as shown below. Since we want to allow user to enter Customer ID, we have to parameterize payload using ESS_REQ token which is used to access request arguments. So in our case, we need to define an argument with name CustomerId.

empayload

Click OK and observe lot of System Properties are populated automatically as shown below.

emsysprop

To define argument for ESS job, click + icon in Application Defined Properties section to bring up following Popup. Given name as CustomerId and Type as String as shown below and click OK.

emargs

Now observe that a new Job Definition is created as shown below.

emjobcreate

Submitting Job

We can manually submit ESS job or use a schedule to run it programmatically. For now, let us proceed with manual submission so right click ESSAPP and choose Submit Job Request as shown below.

emsubmit

Choose Job Definition by clicking search icon as shown below.

submit0

submit2

Click OK and enter value for CustomerID Job Parameter as shown below.

submit1

Click OK to submit ESS job and observe the status and log as shown below. Since it’s a simple service call, the ESS job did not take much time.

emreqsuccess

You can open log file shown above and verify the output as expected.  Since it’s a sync call, we have received service response and same is logged.

emreqlog

To manage the submitted jobs, we can navigate to the Search Job Requests page using navigation shown below.

emjobsearch

Here, you can search for submitted jobs using different search criteria and also can do Cancel, Hold and Resume of job depending on current status of Job.

emreqsuccess1

Note: The use case considered here does not actually qualify as ESS job and not of batch job nature and used just for demonstration purpose. ESS is more suitable for batch jobs as you can schedule and run asynchronously in it’s own JVM.


Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 379 other subscribers

Enter your email address to follow this blog and receive notifications of new posts by email.


%d bloggers like this: