Handle Approval/Rejection of time Entries
Once a time entry is reject/approved by managers on CRSD side we need to update our end by their decision. This document explains how to handle the event of approval or rejection of time entries by managers done in CRSD.
Service bus listener configuration:
Once a manager approves or rejects a time entry on CRSD side, an event will be published into Azure service bus.
The goal is to update the status of a time entry to the manager decision.
This is the config required to be able to capture both Approve and Reject events:
"AzureServiceBus": {
"ConnectionString": "#{AzureServiceBusConnectionString}#",
"TopicName": "crsm-tmapi-timeentry-rejected-topic",
"Subscription": "TimeEntrRejectedWLMsub",
"SubscriptionToTopics": {
"TimeEntryApprovalWLMsub": "crsm-tmapi-timeentry-approval-topic",
"TimeEntrRejectedWLMsub": "crsm-tmapi-timeentry-rejected-topic"
},
"FailedRetryCount": 10,
"FailedRetryInterval": 60
}
And this is the code snippet on how to listen to the published SB published message: (this codes should be written in the controller classes)
[CapSubscribe("crsm-tmapi-timeentry-approval-topic", Group = "TimeEntryApprovalWLMsub")]
[NonAction]
public async Task<Response> ApproveTimeEntrySubscription(TMEventModel res)
{
…
}
[CapSubscribe("crsm-tmapi-timeentry-rejected-topic", Group = "TimeEntryRejectedWLMsub")] [NonAction] public async Task<Response> RejectTimeEntrySubscription(TMEventModel res)
{
…
}