INTRODUCTION
Agent Server is Time Triggered Transaction. Agent has two methods which is GetJob and ExecuteJob. Get Job will collect all Pending Jobs. Execute Job will process the pending tasks that has provided. Based on the customization of Agent has two types.
- Task Q
- Non Task Q
THREAD MODE
- Get Job will run by single thread.
- Execute Job will run in multi thread based on thread count configured.
TRIGGER AGENT
MANUAL MODE
- OOB API – TriggerAgent
- Script – TriggerAgent.cmd agent Criteria ID
AUTOMATIC
- Triggered when it reaches the time interval.
AGENT SERVER PROCESS
- Once the agent is triggered, it will try to lock the YFS_OBJECT_LOCK table by its criteria ID to avoid multiple threads accessing the database at the same time.
- Get Job will fetch the list of records that satisfy all the criteria, then pull those eligible records from the database and drop those in the configured internal server queue.
- The executed job will be executed in parallel based on the thread count, and each record will be processed concurrently to perform the business logic.
- Then Get Job fetches the next set of eligible messages, which are going to be processed by the execute job function. Repeatedly, this procedure will be executed until the getjob has no records for fetching.
- In this state, Agent will move to Ideal until its next trigger internal.
- If any error occurred during the execute job process, that particular record will be error out and continued with other records.
TASK Q AGENT
The getJobs method will look into YFS_Task_Q table for the available records. The TaskQ table has column named ‘Available date’ that holds date information. This date intimates the Date and time that the record is eligible for processing. GetJobs method will fire a Select query that is pull the records that has available date is less than current system time. Those records are converted as a list of documents and returns from the method.
The Execute Job will process those list of records which dropped into the queue as per the business logic. This process will be repeated until no messages are fetched by getjobs.
Interface to implement Task Q agent class : YCPBaseTaskAgent
For example, Schedule Agent, Release Agent, Consolidate to Shipment, and Close Shipment Agent are out-of-the-box implementations for Task Q agent
NON TASK Q AGENT
A Non task Q agent gives the flexibility to customize the GetJobs that can look pull records from any table. Typically it might be custom table or OOB table. On ExecuteJob method, will be utilized to perform business logics. Since GetJob method’s full control is given to user, distinguishing between processed and non-processed records has to take care by the implementation logic.
Interface to implement Non Task Q agent class : YCPBaseAgent
For Example, Order Validation, Exception Reprocess Agent are implemented for Non Task Q Agent to fulfill the custom requirement.
Thank you for taking time to go through this one !
#LetsTalkRetail #SpicaTech