Skip to content

Commit 0a80622

Browse files
authored
Merge pull request #593 from oracle-devrel/pob-parkinglot
Parking Lot pattern OIC Gen3 solution template initial version
2 parents 72b9726 + 28ee90f commit 0a80622

File tree

17 files changed

+888
-0
lines changed

17 files changed

+888
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2023 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# OIC Resilient Batch Processing
2+
3+
This asset contains accelerator type OIC Gen3 implementation of the resilient batch processing on top of Parking Lot Pattern. This pattern address one specific need when using Oracle Integration Cloud OIC for processing many batches. The repository provides the OIC Gen3 project with sample integrations and ATP scripts required for the implementation described in the [README.md](./files/oic-parkinglot/README.md).
4+
5+
# When to use this asset?
6+
7+
Use this asset as an example respectively as the template for the resilient batch services solution. It is good to update the model based on implemented business, capabilities of the target systems and operatioonal and monitoring requirements.
8+
9+
# How to use this asset?
10+
11+
This asset is provided as the resilient batch processing solution template.
12+
Follow the instructions in the [README.md](./files/oic-parkinglot/README.md).
13+
14+
# License
15+
16+
Copyright (c) 2023 Oracle and/or its affiliates.
17+
18+
Licensed under the Universal Permissive License (UPL), Version 1.0.
19+
20+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2023, Oracle and/or its affiliates.
2+
Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
Pull requests can be made under The Oracle Contributor Agreement (OCA).
5+
6+
For pull requests to be accepted, the bottom of your commit message must have the following line using your name and e-mail address as it appears in the OCA Signatories list.
7+
Signed-off-by: Peter Obert <[email protected]>
8+
9+
10+
This can be automatically added to pull requests by committing with:
11+
git commit --signoff
12+
13+
14+
Only pull requests from committers that can be verified as having signed the OCA can be accepted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Copyright (c) 2023, Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
-- ADMIN:Parking12345#
2+
-- Copyright (c) 2020, Oracle and/or its affiliates.
3+
-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
--------------------------------------------------------
5+
-- DDL for Table PAYLOAD_PARKING_LOT_TAB
6+
--------------------------------------------------------
7+
create sequence "ADMIN"."sqname_id_seq" start with 1 increment by 1 nocache;
8+
drop table "ADMIN"."PAYLOAD_PARKING_LOT_TAB";
9+
CREATE TABLE "ADMIN"."PAYLOAD_PARKING_LOT_TAB"
10+
( "ID" NUMBER(*,0) DEFAULT "ADMIN"."sqname_id_seq".nextval, -- BATCHID
11+
"GRPID" VARCHAR2(40 BYTE) COLLATE "USING_NLS_COMP",
12+
"GRPTYPE" VARCHAR2(40 BYTE) COLLATE "USING_NLS_COMP",
13+
"GRPSEQ" NUMBER(*,0),
14+
"PAYLOAD_CLOB" CLOB COLLATE "USING_NLS_COMP",
15+
"PAYLOAD" VARCHAR2(10000 BYTE) COLLATE "USING_NLS_COMP",
16+
"FILENAME" VARCHAR2(40 BYTE) COLLATE "USING_NLS_COMP",
17+
"DIRECTORY" VARCHAR2(200 BYTE) COLLATE "USING_NLS_COMP",
18+
"STATUS" VARCHAR2(20 BYTE) COLLATE "USING_NLS_COMP",
19+
-- NEW - new request/batch
20+
-- SUBMITTED - batch processing triggered
21+
-- PROCESSING - batch contitions passed and processing started
22+
-- FAILED - request/batch processing failed
23+
-- ERROR_RETRY - request/batch ready to be re-processed
24+
"CREATIONTIME" TIMESTAMP(3) NOT NULL,
25+
"STATUSTIME" TIMESTAMP(3) NOT NULL,
26+
"ERROR" VARCHAR2(2000 BYTE) COLLATE "USING_NLS_COMP"
27+
) DEFAULT COLLATION "USING_NLS_COMP" ;
28+
29+
CREATE UNIQUE INDEX "ADMIN"."PK_ID" ON "ADMIN"."PAYLOAD_PARKING_LOT_TAB" ("ID")
30+
;
31+
ALTER TABLE "ADMIN"."PAYLOAD_PARKING_LOT_TAB" ADD CONSTRAINT "PK_ID" PRIMARY KEY ("ID");
32+
--
33+
--drop table "ADMIN"."PAYLOAD_ERRORS_TAB";
34+
create sequence "ADMIN"."error_id_seq" start with 1 increment by 1 nocache;
35+
CREATE TABLE "ADMIN"."PAYLOAD_ERRORS_TAB"
36+
( "ERRID" INT DEFAULT "ADMIN"."error_id_seq".nextval,
37+
"BATCHID" INT NOT NULL,
38+
"GRPID" VARCHAR2(40 BYTE),
39+
"GRPTYPE" VARCHAR2(40 BYTE),
40+
"GRPSEQ" INT,
41+
"PAYLOAD_CLOB" CLOB,
42+
"PAYLOAD" VARCHAR2(10000 BYTE) COLLATE "USING_NLS_COMP",
43+
"STATUS" VARCHAR2(20 BYTE) COLLATE "USING_NLS_COMP",
44+
-- NEW after registering by initial BATCH
45+
-- READY after fixing the payload
46+
-- Whatewer else after failure
47+
"ERROR" VARCHAR2(2000 BYTE) COLLATE "USING_NLS_COMP",
48+
"CREATIONTIME" TIMESTAMP(3) NOT NULL,
49+
"STATUSTIME" TIMESTAMP(3) NOT NULL
50+
) ;
51+
CREATE UNIQUE INDEX "ADMIN"."PKERR_ID" ON "ADMIN"."PAYLOAD_ERRORS_TAB" ("ERRID");
52+
ALTER TABLE "ADMIN"."PAYLOAD_ERRORS_TAB" ADD CONSTRAINT "PKERR_ID" PRIMARY KEY ("ERRID");
53+
54+
--drop table "ADMIN"."BATCH_STATISTICS";
55+
CREATE TABLE "ADMIN"."BATCH_STATISTICS"
56+
(
57+
"BATCHID" INT NOT NULL,
58+
"GRPID" VARCHAR2(40 BYTE),
59+
"GRPTYPE" VARCHAR2(40 BYTE),
60+
"GRPSEQ" INT,
61+
"TOTAL_ROWS" INT,
62+
"PROCESSED_ROWS" INT,
63+
"SUCCEEDED_ROWS" INT,
64+
"FAILED_ROWS" INT,
65+
"CREATIONTIME" TIMESTAMP(3) NOT NULL,
66+
"STATUSTIME" TIMESTAMP(3) NOT NULL,
67+
"STATUS" VARCHAR2(20 BYTE) COLLATE "USING_NLS_COMP",
68+
"ERROR" VARCHAR2(2000 BYTE) COLLATE "USING_NLS_COMP"
69+
);
70+
CREATE UNIQUE INDEX "ADMIN"."BATCH_STATISTICS_PK_ID" ON "ADMIN"."BATCH_STATISTICS" ("BATCHID");
71+
ALTER TABLE "ADMIN"."BATCH_STATISTICS" ADD CONSTRAINT "BATCHID" PRIMARY KEY ("BATCHID");
72+
73+
74+
------------------------------------------------------------------------------------------------------
75+
76+
SELECT * FROM ADMIN.PAYLOAD_PARKING_LOT_TAB ORDER BY ID DESC;
77+
SELECT * FROM ADMIN.BATCH_STATISTICS ORDER BY BATCHID DESC;
78+
SELECT * FROM ADMIN.PAYLOAD_ERRORS_TAB ORDER BY ERRID DESC;
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
![High Level Design Diagram](./images/OICextended_parkinglot_EH_v0.1.png)
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+
![Batch processing scenario](./images/HCM_To_Payroll.drawio.png)
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+
![Batch processing sequence scenario](./images/HCM_To_Payroll.seq.png)
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+
Loading

0 commit comments

Comments
 (0)