TL Cron Job
Functionality:
To send reminder messages one week prior to licenses which are expiring
To expire licenses which have passed there validity
Configuration:
BusinessService:
EXPIRE action is added on APPROVED state which takes the application to new state called EXPIRED. The following are json’s to be added in current businessService:
Action JSON :
{
"action": "EXPIRE",
"nextState": "EXPIRED",
"roles": [
"SYSTEM"
]
}
State JSON:
{
"sla": null,
"state": "EXPIRED",
"applicationStatus": "EXPIRED",
"docUploadRequired": false,
"isStartState": false,
"isTerminateState": true,
"isStateUpdatable": false
}
To update the businessService first search the businessService and then add the above json’s in the search response and then call update on the resulting businessService. ( Action json has to be added inside actions array of APPROVED state and state json can be directly added in states array of businessServices)
MDMS:
MDMS config with name CronJobAPIConfig.json
is added in common master. This config contains the API endpoints which has to be called by the cron job.
{
"tenantId": "pb",
"moduleName": "common-masters",
"CronJobAPIConfig": [
{
"jobName": "daily",
"active": "true",
"method": "POST",
"url": "http://tl-services.egov:8080/tl-services/v1/TL/Expiry/_batch",
"payload": {
"RequestInfo": "{DEFAULT_REQUESTINFO}"
},
"header": {
"Content-Type": "application/json"
}
},
{
"jobName": "daily",
"active": "true",
"method": "POST",
"url": "http://tl-services.egov:8080/tl-services/v1/TL/Reminder/_batch",
"payload": {
"RequestInfo": "{DEFAULT_REQUESTINFO}"
},
"header": {
"Content-Type": "application/json"
}
}
]
}
Active flag can be used to enable or disable particular entry while jobName specifies which cron job will call that endpoint. The placeholder {DEFAULT_REQUESTINFO}
can be used for default RequestInfo. The placeholder will be replaced with RequestInfo containing the userInfo of SYSTEM user with userName CRONJOB.
System User:
If the placeholder {DEFAULT_REQUESTINFO}
is used a user has to be created with role and type SYSTEM and userName CRONJOB. Please Note, the created user must be active. Following is a sample create request:
If the user service build running on current environment encrypts PIIs while storing DB records then in “DataSecurity” module and “DecryptionABAC“ master of mdms ex:- https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/DataSecurity/DecryptionABAC.json In “ALL_ACCESS“ section add following values in “roleAttributeAccessList“.
Kubernetes:
The following is the kubernetes configuration for the cron job:
The cron job timing can be adjusted using the schedule
property. The above value schedule: "1 0 * * *"
will trigger the cron job everyday at 00:01 AM.
To create the cron job the following command can be used:
The cron job can be deleted by:
The above configurations, dockerfile and the python script to be called by cron job are uploaded in the link described below:
https://github.com/egovernments/utilities/tree/API_CRON/egov-api-cron-job
Localization:
Following is the message cURL to be pushed in localization:
Builds:
tl-services and egov-workflow-v2 needs to be promoted.