Sie sind auf Seite 1von 9

Dynamic scheduling of Application Engines

Table of Contents

1.Introduction ........................................................................................... 2 2.Dynamic Scheduling ................................................................................3 2.1 Requirement .................................................................................... 3 2.2 Solution........................................................................................... 3 2.3 Solution Detail..................................................................................4 3.Conclusion ................................................. Error! Bookmark not defined.

1. Introduction PeopleSoft Application Engine is designed for batch processing where you have data that must be processed without user interventionfor example, calculating salaries in payroll processing. However App engine is widely used for many purposes like data migration, data cleansing etc

Application Engine programs are generally scheduled to run as batch processes at specific time as per defined frequency. The instance of each program that is being executed is monitored through PeopleSoft process scheduler. Application Engine programs can also be run one-time from Process Monitor.

There could be a requirement to execute the Application Engine based on certain conditions or business logic which triggers the need to execute the program dynamically. This document is aimed at PeopleSoft developers who have already developed Application Engines for batch program purposes.

The approach taken in this document is to assume a business requirement and walk through the solution step-by-step.

2. Dynamic Scheduling Let us assume XYZ Limited is having PeopleSoft CRM system and the collections system is integrated. Everyday it needs to process the collections data and publish orders to suspend / resume services for customers in the collections. If the customer has not paid in the given time some services are suspended and if the customer has paid the previously suspended services are restored. For this the Application Engine needs to be written and based on the load (no of transactions) there has to be multiple instances of APP engine to process in parallel.

2.1 Requirement The requirements can be summed up from the business case as follows:

1. Create Application engine to process collections data and publish orders 2. Trigger multiple instances App engine based on the number of transactions to be processed.

2.2 Solution The solution is to build an Application Engine program which would act as a master and schedule the multiple instances of processing Application Engine dynamically based on the number of records to be processed. This would be called master application engine and App engine with processing logic is called child app engine.

2.3 Solution Detail An Application Engine is created which would read the master data and setup data to find how many records are to be processed and how many app engine instances are required. The high level design is as follows:

As per the solution following are the main steps in the solution: 1. Populate Collections system data into CRM interface table 2. Read the number of records in the Interface table data to be processed 3. Calculate the number of instances of Child App Engines to be triggered 4. Process Interface table data and create Orders 5. Validate the Orders created in CRM system

1. Populate Collections system data into CRM interface table The daily updates from collection system have to be loaded to the CRM interface table. This can be done using a DB link or flat file extract and load. The status of these records has to be set to To be processed

2. Read the number of records in the Interface table data to be processed The Master App Engine is scheduled to run at specific time interval. Once this App Engine is run it will read number of records to be processed from the interface table having status as To be processed.

3. Calculate the number of instances of Child App Engines to be

triggered

Then the master App engine reads the setup data from setup tables to find how many records an instance of Child App engine should process. Then the Master App engine calculates the number of Child App Engines required to be scheduled to process the data.

4. Process Interface table data and create Orders Once the Master App Engine determines the number of child app engines to be scheduled then it creates the instances and schedules through following PeopleCode:

I.Using ProcessRequest class:

The ProcessRequest class provides properties and a method for scheduling a predefined process or job. The Process has to be defined (using Process Scheduler Manager) before scheduling it using the ProcessRequest class. The properties of this class contain the same values as those required by Process Scheduler Manager for scheduling a process or job.

Local ProcessRequest &PrcsRQST;

& PrcsRQST = CreateProcessRequest("AppEngine", "ChildAppEngine");

Schedule method is used to insert the request in the Process Request table which runs according to the values in the properties of the ProcessRequest object. To successfully schedule a process or job, certain properties are required. Since we are scheduling a single process, values must be set for the following properties: - RunControlID - ProcessName - ProcessType

& PrcsRQST.RunControlID = "MYRUNCONTROLID";

& PrcsRQST.ProcessName = "ChildAppEngine";

& PrcsRQST.ProcessType = "Application Engine";

& PrcsRQST.RunDateTime = %Datetime;

If the value for this property is not set, and there is no date time set for the predefined process or job, the process or job runs as soon as the Schedule method is executed.

& PrcsRQST.Schedule(); If & PrcsRQST.Status = 0 then /* process successfully scheduled */ &ProcInst = & PrcsRQST.ProcessInstance; Else /* do error processing */ End-If;

II.Using CallAppEngine function: CallAppEngine function can be used to start the PeopleSoft Application Engine program. This is how to start your Application Engine programs synchronously from a page. Normally Application Engine execution is done using the Process Scheduler, and the exception would be done using CallAppEngine

The processinstance allows you to specify the process instance used by the Application Engine runtime. In the PeopleCode program this parameter must be declared of type integer since that is the only way the runtime can tell whether the last parameter is to be interpreted as a process instance.

You can use the CallAppEngine function in a PeopleSoft Application Engine program, either directly (in a PeopleCode action) or indirectly (using a Component Interface)

&REC = CreateRecord(RECORD.INIT_VALUES); &REC.FIELD1.Value = "XYZ"; /* set the initial value for INIT_VALUES.FIELD1 */ CallAppEngine("ChildAppEngine", &REC);

Considerations: There are certain restrictions when CallAppEngine function is used to execute the Application Engine.

It must be included within events that allow database updates because generally, it is expected to perform database updates. This includes the following PeopleCode events: SavePreChange (Page) SavePostChange (Page) Workflow FieldChange If CallAppEngine results in a failure, all database updates is rolled back. All information the user entered into the component is lost

Note: For detailed list of considerations (restrictions) please refer to PeopleBook Enterprise PeopleTools 8.49 PeopleBook: PeopleCode Language Reference - CallAppEngine Function

5. Validate the Orders created in CRM system Once all the Orders are created by child app engine the orders should be verified manually either by front end screen or through SQL queries.

Das könnte Ihnen auch gefallen