|
| 1 | +# cloud.asset.integration-oic-parkinglotpattern-batch |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +In this Project, we will illustrate a simple practical example of using the parking lot pattern with Oracle Integration Cloud (OIC) and batch processing style. |
| 6 | +The example will use Autonomous Transaction Processing ([ATP]((https://docs.oracle.com/en/cloud/paas/atp-cloud/index.html))) database for a parking lot table. |
| 7 | + |
| 8 | +This project implements extension of the Resilient Asynchronous Integrations suitable for processing, managing and monitoring pattern based batch style integrations. |
| 9 | + |
| 10 | +The solution is build as the project for [OIC Gen3](https://docs.oracle.com/en-us/iaas/application-integration/index.html). The solution artifacts contains [cloud.asset.integration-oic-parkinglotpattern](https://github.com/oracle/cloud-asset-integration-oic-parkinglotpattern-sample) artifacts migrated to OIC Gen3 as well. |
| 11 | + |
| 12 | +Refer to the blog - [OIC Advanced Error Handling ](https://www.ateam-oracle.com/advanced-error-handling-oic), for a detailed discussion of the Integration design pattern and solution. |
| 13 | + |
| 14 | +Refer to best practice article - [Best practices for building resilient asynchronous integrations](https://docs.oracle.com/en/solutions/best-practices-resilient-asynch-integrations/index.html#GUID-B18DDA79-78FD-4767-BEE6-DB213B5EC073). |
| 15 | + |
| 16 | +The repository provides the OIC Gen3 sample integrations and ATP scripts required for the implementation described in the blog. |
| 17 | + |
| 18 | +## How to Install and Run |
| 19 | +* Download the Car file (within zip archives) from this project and import into target OIC Gen3 environment |
| 20 | +* Configure the required connections and activate the integrations |
| 21 | +* Download the parking lot table creation DDL script file and execute on target database. |
| 22 | +* Refer to the blog - [OIC Advanced Error Handling ](https://www.ateam-oracle.com/advanced-error-handling-oic), for more detailed instructions. |
| 23 | + |
| 24 | +### High Level Design |
| 25 | + Figure below shows the high level design of solution using OIC flows and [ATP DB](https://docs.oracle.com/en/cloud/paas/atp-cloud/index.html) for parking lot table. The OIC solution use Persister, Dispatcher and Processor flows. |
| 26 | + |
| 27 | +  |
| 28 | + |
| 29 | + **Batch processing scenario** is implemented to reflect following processing steps: |
| 30 | + 1. HCM produces CSV File with Employee Bank Connection Information |
| 31 | + 2. Batch “Requestor” integration flow will download file from source e.e.g. File Server/Storage/UCM and Register the Batch Information (opt. de-batch) |
| 32 | + 3. Batch Dispatcher will select from the parked batches which process is ready to start and submits batch |
| 33 | + 4. Batch Processor process the CSV File and documents processing, handles error in Payroll API provisioning and Notifies Result |
| 34 | + |
| 35 | +  |
| 36 | + |
| 37 | + ### Solution Components |
| 38 | +The [Parking Lot pattern](https://www.ateam-oracle.com/oic-error-handling-guide) here uses an ATP table to store request metadata and status information. The OIC Flows in the design are inherited from the original OIC Gen2 resilient services |
| 39 | + * Request Persister |
| 40 | + * Scheduled Dispatcher |
| 41 | + * Async Processor |
| 42 | + |
| 43 | +**For the resilient batch processing additional OIC Flows added** |
| 44 | + * Batch Requests Persister responsible for the Batch Registration and parking the processing |
| 45 | + *SR_BulkDownload_RequestPersister_ATP* |
| 46 | + - Batch Request Registration Provider template schedulable service which scans "Remote FTP Server, transfers the batch CSV file to Local FTP and registers/parks the Batch in the ATP Parking Lot Table. |
| 47 | + |
| 48 | + * Batch Dispatcher for CSV Batch responsible for the submitting the best candidate from the registered and parked batches |
| 49 | + *SR_ScheduledDispatcher_CSVBatch* |
| 50 | + - Dispatcher fetches all the ready/parked batches for the CSV Batch Group Type and triggers one way batch processors. Updates Batch Status to Submitted |
| 51 | + |
| 52 | + * Async Batch Processor responsible for the batch processing in our case it is HCM To Payroll provisioning |
| 53 | + *SR_OneWay_Processor_HCM_To_Payroll* |
| 54 | + - Example of the one-way processor that processes all the submitted batch rows. In this case it it is example of HCM Bank Connections to Payroll. It invokes Payroll Mock Service which represents Payroll API for the employee bank connection |
| 55 | + |
| 56 | + * Resubmission Processor for the fixed and ready payloadsprovisioning |
| 57 | + |
| 58 | + *SR_ScheduledDispatcher_PayrollErrors* |
| 59 | + - Example of the Resubmission Endpoint for the Failed processed rows from the Batch processing. It fetches READY state records form the Failed Payloads table and invokes the row processing service. |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +### Artifacts: |
| 64 | + |
| 65 | +#### DDL script for ATP table |
| 66 | +Parking lot table creation DDL script for sample |
| 67 | + |
| 68 | +#### OIC Flows - Integration Archive - OIC Gen3 Project File (CAR) |
| 69 | +Download the CAR file from this project and import into target OIC environment. Configure the required connections before the integrations activation |
| 70 | + |
| 71 | +#### sample account json file |
| 72 | +Sample json file for a simple account creation request - resilient single payload service |
| 73 | + |
| 74 | +#### sample csv files |
| 75 | +Sample csv files for demonstrating batch with/without errors |
| 76 | + |
| 77 | +#### opaque schema file |
| 78 | +XSD schema file used for persisting json payload into Db parking lot table using Stage file |
| 79 | + |
| 80 | +Refer to the blog - [OIC Advanced Error Handling ](https://www.ateam-oracle.com/advanced-error-handling-oic), for a detailed discussion of the Integration design pattern and solution. |
| 81 | + |
| 82 | +Refer to the blog - [Batch to API - Design for Resiliency Using Oracle Integration](https://www.linkedin.com/posts/ingpeterobert_oic-parkingabrlot-oraclecloud-activity-7065351235192680449-8Bk2?utm_source=share&utm_medium=member_desktop), for the resilient batch metamodel. |
| 83 | + |
| 84 | +## Payload examples of the last mile API - Batch processor and Payroll Bank Connection API |
| 85 | + |
| 86 | +### ./payloads/hcm_bnk_connsX4long.csv - sample file which should pass with no errors |
| 87 | + |
| 88 | +### ./payloads/hcm_bnk_connsNoError4long.csv - sample file containing errors(small employee numbers) |
| 89 | + |
| 90 | +### ./payloads/*.json |
| 91 | + |
| 92 | +#### { "PayrollAPIRequest": |
| 93 | + { |
| 94 | + "employeeNumber":123456789, |
| 95 | + "iban":"GB29 NWBK 6016 1331 9268 19", |
| 96 | + "bankIdentifier": "NWBK", |
| 97 | + "branchIdentifier": "601613", |
| 98 | + "accountNumber": "31926819" |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +#### { "PayrollAPIResponse": |
| 103 | + { |
| 104 | + "status": "SUCCESS", |
| 105 | + "errorCode":"BRS-200", |
| 106 | + "errorMessage": "Possible Error" |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | + |
| 111 | +# |
| 112 | +---------------------------------------------------------- |
| 113 | +## Batch processing finished - notification email template |
| 114 | + |
| 115 | +<html> |
| 116 | +<title>Batch Processing Statistics</title> |
| 117 | + |
| 118 | +<head> |
| 119 | +</head> |
| 120 | + |
| 121 | +<body> |
| 122 | + <h1>Batch Processing Statistics</h1> |
| 123 | + <div>---------------------------------</div> |
| 124 | + <div>BatchID: {batchid}</div> |
| 125 | +<div>---------------------------------</div> |
| 126 | +<div>Filename: {filename}</div> |
| 127 | +<div>Employee connections rows: {rows}</div> |
| 128 | +<div>Processed rows: {aPICalls}</div> |
| 129 | +<div>Succeeded API Calls: {aPISuccess}</div> |
| 130 | +<div>Failed API Calls: {aPIFailed}</div> |
| 131 | +<div>ErrorFile: {errorFile}</div> |
| 132 | +</body> |
| 133 | + |
| 134 | +</html> |
| 135 | + |
| 136 | +# |
| 137 | + |
| 138 | +Copyright (c) 2023, Oracle and/or its affiliates. |
| 139 | +Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
| 140 | + |
0 commit comments