| Bookmark Name | Actions |
|---|
Implementing Scheduler
This section shows the microservices in which you can implement the Scheduler feature and also it shows you the implementation steps.
You can implement the Scheduler feature in the following microservices:
Scheduler is implemented in metering microservice for pulling the data from Temenos Transact and inserting into the log table.
By default, the schedulers are packed in the metering microservice. This can be scheduled in different time for different systems. So, in the scheduled time, this scheduler calls the IRIS API which gives the payload to insert in the metering table.
ms-metering contains three schedulers, namely:
- Metering Scheduler (id: transact)
- Merkle Tree Scheduler (id: merkleTree)
- Merkle Tree Archive Scheduler (id: merkleTreeArchive)
For more details about the metering scheduler, see the APIs section of Metering microservice.
ms-payments is a sample SQL based microservice developed for in-house testing purposes. It simulates a payment order management system. Payment Scheduler (id: paymentscheduler) is a scheduler implementation available in ms-payments microservice.
ms-paymentorder is a sample NOSQL based microservice, developed for in-house testing purposes. It also simulates the payment order management system. Payment Scheduler (id: paymentscheduler) is a scheduler implementation available in ms-paymentorder microservice.
Configuration
Schedulers are uniquely identified by the ID (that is operation ID) associated with it. In order to implement scheduler in a microservice, you must implement the SchedulerFunctionInterface interface in the business implementation class and add the business logic in invoke method by overriding.
The method signature of invoke method is as follows:
SchedulerCommandOutput invoke (Context context, SchedulerCommandInput input)
Where,
- Context – Scheduler context
- SchedulerCommandInput – Input payload containing operation Id and additional parameters for scheduler execution that can be passed at runtime.
- SchedulerCommandOutput – Output payload containing attributes for response body such as status, message, response object, etc.
Configuring Scheduler in Docker
Procedure
- Add the scheduler.json file containing the operationId (mandatory) and parameters under <ms-project>-core/src/main/resources/scheduler/. See a sample scheduler.json for reference.
- Add .package-project-scheduler-enabled under <ms-project>-package\<ms-project>-package-docker/ for creating ${artifact-id}-scheduler.jar.
- Make sure dockerfile is available under <ms-project>-package/<ms- project> -package-docker/src/docker/app/ms-framework-scheduler/Dockerfile.
- Make sure the following properties are set in the config/ENV.env file.
- Define a container for scheduler in docker-compose.yml that is ${artifact-id}.yml.
SCHEDULER_CONTEXT=app/ms-framework-scheduler/.
scheduler_artifactid=${artifact-id}-scheduler.jar
SCHEDULER_IMAGE=temenos/${artifact-id}-scheduler
SCHEDULER_BASE_IMAGE=openjdk:8-jre-alpine
- Make sure the scheduler container has the following environment variables.
className_<operationId>: <fully qualified class name of class containing the scheduler business logic> → operationId to implementation class mapping temn.msf.scheduler.<operationId>.cron.trigger.time: <CRON expression> → CRON trigger time mapping class.inbox.dao: com.temenos.microservice.framework.core.inbox.InboxDaoImpl → property for inbox class.outbox.dao: com.temenos.microservice.framework.core.outbox.OutboxDaoImpl → property for outbox
Configuring Scheduler in AWS
Procedure
- Create a lambda function for scheduler using the install scripts.
- Create a cloud watch rule using CRON expressions.
- Add permissions for the new lambda function and configure the cloud watch rule to trigger scheduler lambda function.
Configuring Scheduler in Azure
Procedure
- Make sure to add .package-project-scheduler-enabled under <ms-project>-package/<ms-project>-package-azure/, so that the scheduler folder gets created with appropriate function.json file inside target/azure-functions/<functionapp>/ after the build.
- In install scripts, make sure to add the following scheduler specific properties.
className_<operationId>=<fully qualified class name> schedulerTime=%SCHEDULER_TIME_CRON_EXPRESSION% operationId=<operationId> parameters=<payload in JSON format>
Add Bookmark
save your best linksView Bookmarks
Visit your best linksIn this topic
Are you sure you want to log-off?