orbit-code-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -0
- package/README.md +326 -0
- package/_agent_reference/components/audit-logging.md +129 -0
- package/_agent_reference/components/common-utils.md +146 -0
- package/_agent_reference/components/error-handling.md +117 -0
- package/_agent_reference/components/http-adapters.md +134 -0
- package/_agent_reference/components/input-adapters.md +101 -0
- package/_agent_reference/components/output-adapters.md +124 -0
- package/_agent_reference/components/property-reader.md +100 -0
- package/_agent_reference/components/retry.md +107 -0
- package/_agent_reference/config/naming-conventions.md +188 -0
- package/_agent_reference/config/properties-template.md +158 -0
- package/_agent_reference/config/queue-definition.md +141 -0
- package/_agent_reference/esql-coding-standards.md +112 -0
- package/_agent_reference/msgflow-xml-reference.md +207 -0
- package/_agent_reference/node_types_extended.md +211 -0
- package/_agent_reference/templates/file-flow.md +212 -0
- package/_agent_reference/templates/http-flow.md +185 -0
- package/_agent_reference/templates/mq-flow.md +248 -0
- package/bin/import-specifier.mjs +13 -0
- package/bin/import-specifier.test.mjs +13 -0
- package/bin/orbit +32 -0
- package/dist/cli.mjs +492705 -0
- package/package.json +149 -0
- package/skills/ace-app-http/SKILL.md +523 -0
- package/skills/ace-app-mq/SKILL.md +554 -0
- package/skills/apic-api/SKILL.md +645 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Naming Conventions
|
|
2
|
+
|
|
3
|
+
All naming in this framework follows strict conventions. The agent MUST follow these when generating any new code, files, or scripts.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ESQL Broker Schema
|
|
8
|
+
|
|
9
|
+
```esql
|
|
10
|
+
BROKER SCHEMA Qiwa.<ApplicationName>
|
|
11
|
+
-- Examples:
|
|
12
|
+
BROKER SCHEMA Qiwa.BS_Account
|
|
13
|
+
BROKER SCHEMA Qiwa.BS_Transfer
|
|
14
|
+
BROKER SCHEMA Qiwa.Framework.Lib ← shared lib only, never use for app code
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ESQL Module Naming
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
<FlowName>_<Purpose>.esql
|
|
23
|
+
|
|
24
|
+
Purpose conventions:
|
|
25
|
+
_Compute ← main business logic, validation, routing
|
|
26
|
+
_PrepareRequest ← format outgoing backend request
|
|
27
|
+
_MapResponse ← map backend response to ESB format
|
|
28
|
+
_PrepareAudit ← prepare audit-specific data
|
|
29
|
+
_Filter ← boolean filter/routing conditions
|
|
30
|
+
_IsXxx ← boolean check (returns TRUE/FALSE)
|
|
31
|
+
_SetXxx ← setter (modifies state)
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
GetAccountDetails_Compute.esql
|
|
35
|
+
GetAccountDetails_PrepareRequest.esql
|
|
36
|
+
GetAccountDetails_MapResponse.esql
|
|
37
|
+
MQ_Input_Node_IsAuditEnabled.esql
|
|
38
|
+
ErrorHandler_IsExceptionCaught.esql
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Message Flow Naming
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
<FlowName>.msgflow
|
|
47
|
+
|
|
48
|
+
FlowName = PascalCase, verb-first, descriptive
|
|
49
|
+
Examples:
|
|
50
|
+
GetAccountDetails.msgflow
|
|
51
|
+
SearchCustomerTransactions.msgflow
|
|
52
|
+
CreateBeneficiary.msgflow
|
|
53
|
+
UpdateAccountNickname.msgflow
|
|
54
|
+
ProcessBatchFile.msgflow
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Application / Project Naming
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
<Tier>_<Domain>
|
|
63
|
+
Tier: BS (Business Service) | ESB (Enterprise Service Bus)
|
|
64
|
+
Domain: PascalCase domain name
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
BS_Account
|
|
68
|
+
BS_Transfer
|
|
69
|
+
BS_Beneficiaries
|
|
70
|
+
ESB_Common
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Properties File Naming
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
<DOMAIN>-PROPERTIES.xml (ALL-CAPS domain)
|
|
79
|
+
Examples:
|
|
80
|
+
ACCOUNT-PROPERTIES.xml
|
|
81
|
+
TRANSFER-PROPERTIES.xml
|
|
82
|
+
BENEFICIARIES-PROPERTIES.xml
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Properties Group Naming
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Group name = {ApplicationLabel}.{FlowName}
|
|
89
|
+
Examples:
|
|
90
|
+
BS_Account.GetAccountDetails
|
|
91
|
+
BS_Transfer.CreateTransfer
|
|
92
|
+
BS_Beneficiaries.SearchBeneficiaries
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Queue Naming
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
<Tier>.<VERB>.<DOMAIN>.<RESOURCE>.<QUALIFIER>.<TYPE>
|
|
101
|
+
|
|
102
|
+
Tier: BS | ESB
|
|
103
|
+
VERB: GET | SEARCH | CREATE | UPDATE | DELETE | PROCESS (ALL-CAPS)
|
|
104
|
+
DOMAIN: domain name in ALL-CAPS
|
|
105
|
+
RESOURCE: resource name in ALL-CAPS
|
|
106
|
+
QUALIFIER: additional context in ALL-CAPS (optional)
|
|
107
|
+
TYPE: RQ (request) | RS (response)
|
|
108
|
+
|
|
109
|
+
Dead letter: append .BACKOUT to the primary queue name
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ
|
|
113
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RS
|
|
114
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ.BACKOUT
|
|
115
|
+
BS.SEARCH.CUST.ACCT.LASTN.TRAN.RQ
|
|
116
|
+
ESB.COMMON.UPDATE.CUSTOMER.ACCOUNT.NICKNAME.RQ
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Queue/Shell Script Naming
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
<DOMAIN>QueuesDefinition.sh (ALL-CAPS domain)
|
|
125
|
+
Examples:
|
|
126
|
+
ACCOUNTQueuesDefinition.sh
|
|
127
|
+
TRANSFERQueuesDefinition.sh
|
|
128
|
+
BENEFICIARIESQueuesDefinition.sh
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## DB Script Naming
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
<DOMAIN>DBScript.sql (ALL-CAPS domain)
|
|
135
|
+
Examples:
|
|
136
|
+
ACCOUNTDBScript.sql
|
|
137
|
+
TRANSFERDBScript.sql
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## ESBFUNCID (Service Identifier in DB)
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Format: <ABBREV><SEQ>
|
|
146
|
+
ABBREV: 4-char uppercase abbreviation of service name
|
|
147
|
+
SEQ: 4-digit sequence starting at 0001
|
|
148
|
+
|
|
149
|
+
Examples:
|
|
150
|
+
ACCD0001 ← Account Details
|
|
151
|
+
TRFR0001 ← Transfer Request
|
|
152
|
+
BNFD0001 ← Beneficiary Details
|
|
153
|
+
SRCH0001 ← Search operation
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Must be unique across ALL services in `MCR_CHANNESBFUNC_TBL`.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Subflow Terminal Naming
|
|
161
|
+
|
|
162
|
+
Standard terminal names used in the framework:
|
|
163
|
+
|
|
164
|
+
| Terminal | Meaning |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `out` | Success path |
|
|
167
|
+
| `failure` | Exception / error path → always wire to ErrorHandler |
|
|
168
|
+
| `true` | Filter condition matched |
|
|
169
|
+
| `false` | Filter condition not matched |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Summary Table
|
|
174
|
+
|
|
175
|
+
| Artifact | Format | Example |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| ESQL schema | `Qiwa.<AppName>` | `Qiwa.BS_Account` |
|
|
178
|
+
| ESQL module | `<Flow>_<Purpose>.esql` | `GetAccountDetails_Compute.esql` |
|
|
179
|
+
| Message flow | `<FlowName>.msgflow` | `GetAccountDetails.msgflow` |
|
|
180
|
+
| Application | `<Tier>_<Domain>` | `BS_Account` |
|
|
181
|
+
| Properties file | `<DOMAIN>-PROPERTIES.xml` | `ACCOUNT-PROPERTIES.xml` |
|
|
182
|
+
| Properties group | `<AppLabel>.<FlowName>` | `BS_Account.GetAccountDetails` |
|
|
183
|
+
| Request queue | `<Tier>.<VERB>.<DOMAIN>.<RES>.RQ` | `BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ` |
|
|
184
|
+
| Response queue | `<Tier>.<VERB>.<DOMAIN>.<RES>.RS` | `BS.GET.CUSTOMER.ACCOUNT.DETAILS.RS` |
|
|
185
|
+
| Backout queue | `<QUEUE_NAME>.BACKOUT` | `BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ.BACKOUT` |
|
|
186
|
+
| Queue script | `<DOMAIN>QueuesDefinition.sh` | `ACCOUNTQueuesDefinition.sh` |
|
|
187
|
+
| DB script | `<DOMAIN>DBScript.sql` | `ACCOUNTDBScript.sql` |
|
|
188
|
+
| ESBFUNCID | `<ABBREV><4-digit-seq>` | `ACCD0001` |
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Properties File Template
|
|
2
|
+
|
|
3
|
+
Every application has one XML properties file loaded by `PropertyReader`. The file lives in the Framework root alongside other `*-PROPERTIES.xml` files.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Naming
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<DOMAIN>-PROPERTIES.xml
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
ACCOUNT-PROPERTIES.xml
|
|
14
|
+
TRANSFER-PROPERTIES.xml
|
|
15
|
+
MYSERVICE-PROPERTIES.xml
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use ALL-CAPS domain name.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Full Template
|
|
23
|
+
|
|
24
|
+
```xml
|
|
25
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
26
|
+
<properties refresh-policy="automatic">
|
|
27
|
+
|
|
28
|
+
<!--
|
|
29
|
+
Group name format: {ApplicationLabel}.{FlowName}
|
|
30
|
+
ApplicationLabel: set on PropertyReader node, e.g. "BS_MyService"
|
|
31
|
+
FlowName: the message flow name, e.g. "GetMyData"
|
|
32
|
+
-->
|
|
33
|
+
<group name="BS_MyService.GetMyData">
|
|
34
|
+
|
|
35
|
+
<!-- ═══════════════════════════════════════════
|
|
36
|
+
LOGGING & AUDIT
|
|
37
|
+
═══════════════════════════════════════════ -->
|
|
38
|
+
<group name="Logging">
|
|
39
|
+
<!-- Enable/disable log (full message body stored) -->
|
|
40
|
+
<property name="LogEnabled" value="TRUE" />
|
|
41
|
+
<!-- Enable/disable audit (key fields + timestamps) -->
|
|
42
|
+
<property name="AuditEnabled" value="TRUE" />
|
|
43
|
+
<!-- Enable/disable field masking in audit -->
|
|
44
|
+
<property name="MaskingEnabled" value="TRUE" />
|
|
45
|
+
|
|
46
|
+
<!-- Up to 10 key-value pairs to extract from message for audit -->
|
|
47
|
+
<!-- key = human label, value = XPath-style path into message tree -->
|
|
48
|
+
<property name="key1" value="CUSTOMER.ID" />
|
|
49
|
+
<property name="value1" value="*.Body.CustomerId" />
|
|
50
|
+
<property name="key2" value="ACCOUNT.NO" />
|
|
51
|
+
<property name="value2" value="*.Body.AccountNumber" />
|
|
52
|
+
<!-- key3-key10, value3-value10 as needed -->
|
|
53
|
+
|
|
54
|
+
<!-- Fields to mask in INCOMING request audit (multi-value) -->
|
|
55
|
+
<property name="maskingIn">
|
|
56
|
+
<value>*.Header.ChannelUserInfo.UserPassword</value>
|
|
57
|
+
<!-- add more sensitive fields here -->
|
|
58
|
+
</property>
|
|
59
|
+
<!-- Fields to mask in OUTGOING response audit (multi-value) -->
|
|
60
|
+
<property name="maskingOut">
|
|
61
|
+
<value>*.Header.ChannelUserInfo.UserPassword</value>
|
|
62
|
+
</property>
|
|
63
|
+
</group>
|
|
64
|
+
|
|
65
|
+
<!-- ═══════════════════════════════════════════
|
|
66
|
+
RETRY
|
|
67
|
+
═══════════════════════════════════════════ -->
|
|
68
|
+
<group name="Retry">
|
|
69
|
+
<property name="RetryEnabled" value="FALSE" />
|
|
70
|
+
<property name="maxRetryCount" value="5" />
|
|
71
|
+
<property name="minWaitDurationSec" value="60" />
|
|
72
|
+
</group>
|
|
73
|
+
|
|
74
|
+
<!-- ═══════════════════════════════════════════
|
|
75
|
+
INTERNAL SERVICE CHAINING
|
|
76
|
+
═══════════════════════════════════════════ -->
|
|
77
|
+
<group name="Variables">
|
|
78
|
+
<!-- Offset added to correlation ID for each leg of a chained flow -->
|
|
79
|
+
<property name="callCorrIDOffset" value="1" />
|
|
80
|
+
</group>
|
|
81
|
+
|
|
82
|
+
<!-- ═══════════════════════════════════════════
|
|
83
|
+
SCHEMA VALIDATION
|
|
84
|
+
═══════════════════════════════════════════ -->
|
|
85
|
+
<group name="SchemaValidation">
|
|
86
|
+
<property name="ValidationEnabled" value="FALSE" />
|
|
87
|
+
</group>
|
|
88
|
+
|
|
89
|
+
<!-- ═══════════════════════════════════════════
|
|
90
|
+
MQ MESSAGE PRIORITY
|
|
91
|
+
═══════════════════════════════════════════ -->
|
|
92
|
+
<group name="Priority">
|
|
93
|
+
<!-- MQ message priority: 0 (lowest) to 9 (highest). Default: 4 -->
|
|
94
|
+
<property name="Priority" value="4" />
|
|
95
|
+
</group>
|
|
96
|
+
|
|
97
|
+
<!-- ═══════════════════════════════════════════
|
|
98
|
+
BACKEND ROUTING
|
|
99
|
+
═══════════════════════════════════════════ -->
|
|
100
|
+
<group name="BankIdForRoutingService">
|
|
101
|
+
<!--
|
|
102
|
+
Multi-value property. Each <property> is one route.
|
|
103
|
+
Values within each property:
|
|
104
|
+
[1] = backend system ID (e.g. T24, NIWS, ODM)
|
|
105
|
+
[2] = service/operation name
|
|
106
|
+
[3] = full URL
|
|
107
|
+
-->
|
|
108
|
+
<property name="qiwa">
|
|
109
|
+
<value>T24</value>
|
|
110
|
+
<value>GetMyDataService</value>
|
|
111
|
+
<value>http://backend-host:7800/services/GetMyData</value>
|
|
112
|
+
</property>
|
|
113
|
+
</group>
|
|
114
|
+
|
|
115
|
+
</group>
|
|
116
|
+
|
|
117
|
+
<!-- Add more flow groups here:
|
|
118
|
+
<group name="BS_MyService.CreateMyData">
|
|
119
|
+
...
|
|
120
|
+
</group>
|
|
121
|
+
-->
|
|
122
|
+
|
|
123
|
+
</properties>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Accessing Properties in ESQL
|
|
129
|
+
|
|
130
|
+
```esql
|
|
131
|
+
-- Pattern: Environment.Properties.{ApplicationLabel}.{FlowName}.{Group}.{Property}
|
|
132
|
+
|
|
133
|
+
-- Boolean flags
|
|
134
|
+
Environment.Properties.BS_MyService.GetMyData.Logging.AuditEnabled
|
|
135
|
+
Environment.Properties.BS_MyService.GetMyData.Retry.RetryEnabled
|
|
136
|
+
|
|
137
|
+
-- Numeric
|
|
138
|
+
Environment.Properties.BS_MyService.GetMyData.Retry.maxRetryCount
|
|
139
|
+
Environment.Properties.BS_MyService.GetMyData.Priority.Priority
|
|
140
|
+
|
|
141
|
+
-- Multi-value (index starts at 1)
|
|
142
|
+
Environment.Properties.BS_MyService.GetMyData.BankIdForRoutingService.qiwa[1] -- 'T24'
|
|
143
|
+
Environment.Properties.BS_MyService.GetMyData.BankIdForRoutingService.qiwa[2] -- 'GetMyDataService'
|
|
144
|
+
Environment.Properties.BS_MyService.GetMyData.BankIdForRoutingService.qiwa[3] -- URL
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Required Groups (every flow must have)
|
|
150
|
+
|
|
151
|
+
| Group | Required Properties |
|
|
152
|
+
|---|---|
|
|
153
|
+
| `Logging` | `LogEnabled`, `AuditEnabled`, `MaskingEnabled`, `maskingIn` (at minimum with UserPassword) |
|
|
154
|
+
| `Retry` | `RetryEnabled` |
|
|
155
|
+
| `SchemaValidation` | `ValidationEnabled` |
|
|
156
|
+
| `Priority` | `Priority` |
|
|
157
|
+
|
|
158
|
+
`Variables` and `BankIdForRoutingService` only needed if the flow uses service chaining or backend HTTP calls respectively.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Queue Definition Template
|
|
2
|
+
|
|
3
|
+
Every MQ-based application needs an MQSC shell script to create its queues. HTTP and File flows do NOT need queue definitions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Naming
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<Domain>QueuesDefinition.sh
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
ACCOUNTQueuesDefinition.sh
|
|
14
|
+
TRANSFERQueuesDefinition.sh
|
|
15
|
+
MYSERVICEQueuesDefinition.sh
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Queue Naming Convention
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<Tier>.<Verb>.<Domain>.<Resource>.<Qualifier>.RQ ← request queue
|
|
24
|
+
<Tier>.<Verb>.<Domain>.<Resource>.<Qualifier>.RS ← response queue
|
|
25
|
+
<QUEUE_NAME>.BACKOUT ← dead letter queue
|
|
26
|
+
|
|
27
|
+
Tier: BS (Business Service) | ESB (Enterprise Service Bus)
|
|
28
|
+
Verb: GET | SEARCH | CREATE | UPDATE | DELETE | PROCESS
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
```
|
|
33
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ
|
|
34
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RS
|
|
35
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RQ.BACKOUT
|
|
36
|
+
BS.GET.CUSTOMER.ACCOUNT.DETAILS.RS.BACKOUT
|
|
37
|
+
|
|
38
|
+
ESB.COMMON.UPDATE.CUSTOMER.ACCOUNT.NICKNAME.RQ
|
|
39
|
+
ESB.COMMON.UPDATE.CUSTOMER.ACCOUNT.NICKNAME.RS
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Shell Script Template
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
#!/bin/bash
|
|
48
|
+
# Queue definitions for <DOMAIN> service
|
|
49
|
+
# Application: <ApplicationName>
|
|
50
|
+
# Created: <date>
|
|
51
|
+
|
|
52
|
+
QMGR_NAME="QMGR01" # replace with actual queue manager name
|
|
53
|
+
|
|
54
|
+
runmqsc ${QMGR_NAME} << EOF
|
|
55
|
+
|
|
56
|
+
*---------------------------------------------------------
|
|
57
|
+
* <FlowName> - <Brief Description>
|
|
58
|
+
*---------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
DEFINE QLOCAL('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RQ.BACKOUT') +
|
|
61
|
+
DEFPSIST(YES) +
|
|
62
|
+
MAXDEPTH(640000) +
|
|
63
|
+
REPLACE
|
|
64
|
+
|
|
65
|
+
DEFINE QLOCAL('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RQ') +
|
|
66
|
+
DEFPSIST(YES) +
|
|
67
|
+
MAXDEPTH(640000) +
|
|
68
|
+
BOQNAME('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RQ.BACKOUT') +
|
|
69
|
+
BOTHRESH(5) +
|
|
70
|
+
REPLACE
|
|
71
|
+
|
|
72
|
+
DEFINE QLOCAL('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RS.BACKOUT') +
|
|
73
|
+
DEFPSIST(YES) +
|
|
74
|
+
MAXDEPTH(640000) +
|
|
75
|
+
REPLACE
|
|
76
|
+
|
|
77
|
+
DEFINE QLOCAL('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RS') +
|
|
78
|
+
DEFPSIST(YES) +
|
|
79
|
+
MAXDEPTH(640000) +
|
|
80
|
+
BOQNAME('BS.<VERB>.<RESOURCE>.<QUALIFIER>.RS.BACKOUT') +
|
|
81
|
+
BOTHRESH(5) +
|
|
82
|
+
REPLACE
|
|
83
|
+
|
|
84
|
+
*---------------------------------------------------------
|
|
85
|
+
* Add more queue pairs below for additional flows
|
|
86
|
+
*---------------------------------------------------------
|
|
87
|
+
|
|
88
|
+
EOF
|
|
89
|
+
|
|
90
|
+
echo "Queue definitions complete for ${QMGR_NAME}"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Queue Properties Reference
|
|
96
|
+
|
|
97
|
+
| Property | Value | Meaning |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `DEFPSIST(YES)` | YES | Messages survive broker restart |
|
|
100
|
+
| `MAXDEPTH(640000)` | 640,000 | Max messages in queue |
|
|
101
|
+
| `BOQNAME(...)` | Queue name | Backout queue for failed messages |
|
|
102
|
+
| `BOTHRESH(5)` | 5 | Move to backout queue after 5 failed gets |
|
|
103
|
+
| `REPLACE` | — | Overwrite if queue already exists |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## DB Script Template
|
|
108
|
+
|
|
109
|
+
Every new service must also be registered in the routing database.
|
|
110
|
+
|
|
111
|
+
**File naming**: `<Domain>DBScript.sql`
|
|
112
|
+
|
|
113
|
+
```sql
|
|
114
|
+
-- ==========================================================
|
|
115
|
+
-- Service registration for <ApplicationName>
|
|
116
|
+
-- ==========================================================
|
|
117
|
+
|
|
118
|
+
-- Register service operation(s) in routing table
|
|
119
|
+
-- ESBFUNCID: unique 8-char ID, format: <ABBREV><SEQ> e.g. GMYD0001
|
|
120
|
+
INSERT INTO MCR_CHANNESBFUNC_TBL (ESBFUNCID, ESBFUNCNAME, REQUEST_QUEUE_NAME, RESPONSE_QUEUE_NAME)
|
|
121
|
+
VALUES ('XXXX0001', 'GET_MY_DATA', 'BS.GET.MY.DATA.RQ', 'BS.GET.MY.DATA.RS');
|
|
122
|
+
|
|
123
|
+
-- Grant access to channels that can call this service
|
|
124
|
+
-- Common CHANNID values: MOBILE, WEB, IVR, BATCH, INTERNAL
|
|
125
|
+
INSERT INTO MCR_CHANNAUTH_TBL (CHANNID, ESBFUNCID) VALUES ('MOBILE', 'XXXX0001');
|
|
126
|
+
INSERT INTO MCR_CHANNAUTH_TBL (CHANNID, ESBFUNCID) VALUES ('WEB', 'XXXX0001');
|
|
127
|
+
INSERT INTO MCR_CHANNAUTH_TBL (CHANNID, ESBFUNCID) VALUES ('INTERNAL', 'XXXX0001');
|
|
128
|
+
|
|
129
|
+
COMMIT;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Checklist
|
|
135
|
+
|
|
136
|
+
- [ ] One backout queue per primary queue (never skip this)
|
|
137
|
+
- [ ] `DEFPSIST(YES)` on all queues (messages must survive restart)
|
|
138
|
+
- [ ] `BOTHRESH(5)` on all primary queues
|
|
139
|
+
- [ ] Register each operation in `MCR_CHANNESBFUNC_TBL`
|
|
140
|
+
- [ ] Grant channel access in `MCR_CHANNAUTH_TBL` for each allowed channel
|
|
141
|
+
- [ ] `ESBFUNCID` must be unique across all services (check existing DB scripts)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ESQL Coding Standards & Syntax (Authoritative)
|
|
2
|
+
|
|
3
|
+
Load this file before writing, editing, refactoring, or reviewing any `.esql` module.
|
|
4
|
+
|
|
5
|
+
## ESQL Expertise & Syntax
|
|
6
|
+
- **Core constructs:** DECLARE, SET, IF/ELSEIF/ELSE, CASE, WHILE, FOR, BEGIN/END, ROW, LIST
|
|
7
|
+
- **Variable types:** Standard variables, SHARED variables (cache), EXTERNAL variables (User Defined Properties / UDPs)
|
|
8
|
+
- **Built-in functions:** CAST, SUBSTRING, TRIM, UPPER, LOWER, LENGTH, POSITION, REPLACE, COALESCE, OVERLAY, EVAL, CARDINALITY, FIELDNAME, FIELDTYPE, FIELDVALUE, EXISTS, LASTMOVE, ASBITSTREAM, THE
|
|
9
|
+
- **Message tree domains:** InputRoot, OutputRoot, Environment, LocalEnvironment, InputLocalEnvironment, InputExceptionList
|
|
10
|
+
- **Parser domains:** XMLNSC, JSON, DFDL, MRM, BLOB, MIME, SOAP
|
|
11
|
+
- **Namespace handling:** Strictly enforce DECLARE NAMESPACE for XMLNSC and SOAP domains. Use namespaces correctly in tree navigation
|
|
12
|
+
- **Routing & Propagation:** PROPAGATE TO TERMINAL 'out' / 'out1' / 'out2' / 'failure' / 'alternate'. PROPAGATE TO LABEL
|
|
13
|
+
- **Error handling:** THROW USER EXCEPTION, RESIGNAL, parsing InputExceptionList tree to extract BIP messages
|
|
14
|
+
- **Database access:** ESQL PASSTHRU, SELECT/INSERT/UPDATE/DELETE via ODBC datasources. Handle nulls safely
|
|
15
|
+
- **Module types:** CREATE COMPUTE MODULE, CREATE FILTER MODULE, CREATE DATABASE MODULE, CREATE FUNCTION, CREATE PROCEDURE
|
|
16
|
+
|
|
17
|
+
## Coding Standards — ESQL (STRICT RULES)
|
|
18
|
+
|
|
19
|
+
### REFERENCE TO (mandatory)
|
|
20
|
+
Always use REFERENCE TO for repeated access to the same tree path. Never repeat a full path like `InputRoot.XMLNSC.Order.Item` multiple times — declare a reference and use it:
|
|
21
|
+
```esql
|
|
22
|
+
-- WRONG: repeated full tree paths
|
|
23
|
+
SET OutputRoot.XMLNSC.Response.Header.Status = 'OK';
|
|
24
|
+
SET OutputRoot.XMLNSC.Response.Header.Code = '200';
|
|
25
|
+
|
|
26
|
+
-- CORRECT: use REFERENCE TO
|
|
27
|
+
DECLARE refHeader REFERENCE TO OutputRoot.XMLNSC.Response.Header;
|
|
28
|
+
SET refHeader.Status = 'OK';
|
|
29
|
+
SET refHeader.Code = '200';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### CARDINALITY optimization (mandatory)
|
|
33
|
+
Never call CARDINALITY() inside a WHILE loop condition. Evaluate it once into a declared INTEGER before the loop:
|
|
34
|
+
```esql
|
|
35
|
+
-- WRONG
|
|
36
|
+
WHILE I <= CARDINALITY(InputRoot.XMLNSC.Items.Item[]) DO
|
|
37
|
+
|
|
38
|
+
-- CORRECT
|
|
39
|
+
DECLARE itemCount INTEGER CARDINALITY(InputRoot.XMLNSC.Items.Item[]);
|
|
40
|
+
WHILE I <= itemCount DO
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Full message copy
|
|
44
|
+
Use `SET OutputRoot = InputRoot;` for full copies — do not copy field by field.
|
|
45
|
+
|
|
46
|
+
### Memory management
|
|
47
|
+
Use `DELETE FIELD` to remove Environment and LocalEnvironment variables after processing to avoid memory leaks in batch processing.
|
|
48
|
+
|
|
49
|
+
### Comments
|
|
50
|
+
Comment complex transformations — explain the business intent, not the mechanics.
|
|
51
|
+
|
|
52
|
+
### Standard boilerplate
|
|
53
|
+
Every Compute module MUST include CopyMessageHeaders() and CopyEntireMessage() procedures:
|
|
54
|
+
```esql
|
|
55
|
+
CREATE PROCEDURE CopyMessageHeaders() BEGIN
|
|
56
|
+
DECLARE I INTEGER 1;
|
|
57
|
+
DECLARE headerCount INTEGER CARDINALITY(InputRoot.*[]);
|
|
58
|
+
WHILE I < headerCount DO
|
|
59
|
+
SET OutputRoot.*[I] = InputRoot.*[I];
|
|
60
|
+
SET I = I + 1;
|
|
61
|
+
END WHILE;
|
|
62
|
+
END;
|
|
63
|
+
|
|
64
|
+
CREATE PROCEDURE CopyEntireMessage() BEGIN
|
|
65
|
+
SET OutputRoot = InputRoot;
|
|
66
|
+
END;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Coding Standards — Database Access (STRICT RULES)
|
|
70
|
+
|
|
71
|
+
### Stored procedures
|
|
72
|
+
Declare with: `LANGUAGE DATABASE DYNAMIC RESULT SETS 1 EXTERNAL NAME "dbo.<ProcedureName>"`
|
|
73
|
+
Store outputs into `Environment.Variables.<ArrayName>.ResultSet[]`
|
|
74
|
+
|
|
75
|
+
### SQL injection prevention (CRITICAL)
|
|
76
|
+
PASSTHRU with string concatenation is STRICTLY FORBIDDEN. All dynamic queries MUST use parameterized form with ? placeholders:
|
|
77
|
+
```esql
|
|
78
|
+
-- FORBIDDEN — SQL injection risk
|
|
79
|
+
PASSTHRU('SELECT * FROM users WHERE id = ' || CAST(userId AS CHARACTER));
|
|
80
|
+
|
|
81
|
+
-- REQUIRED — parameterized query
|
|
82
|
+
PASSTHRU('SELECT * FROM users WHERE id = ?' TO Database.DSN VALUES(userId));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Coding Standards — Error Handling
|
|
86
|
+
- Do NOT use THROW USER EXCEPTION for business logic validations
|
|
87
|
+
- Set error state via: `SET Environment.Variables.MWResponse.status = '<error_code>';`
|
|
88
|
+
- Use `CALL getEsbChannlsErrorCodeDescriptionFrom(errorCode, language, errorDescription)` for localized error messages
|
|
89
|
+
- Use `CALL Create_esbXML_Response_Header(...)` for standardized XML response headers
|
|
90
|
+
- All error flows MUST route through the framework `LogError` subflow
|
|
91
|
+
- Route validation failures using `PROPAGATE TO TERMINAL 'out2'; RETURN FALSE;`
|
|
92
|
+
|
|
93
|
+
## Coding Standards — Naming Conventions
|
|
94
|
+
|
|
95
|
+
| Artifact | Convention | Example |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| BROKER SCHEMA | com.qiwa.esb.<flow_name_lowercase> | com.qiwa.esb.employeeflow |
|
|
98
|
+
| ESQL module | <FlowName>_<NodeName> | CheckValTransEmployeeFlow_CallDB_GetUser |
|
|
99
|
+
| Node names | UpperCamelCase, descriptive | ValidateRequest, CallEmployeeDB |
|
|
100
|
+
| Subflow names | UpperCamelCase | GetEmployeeData |
|
|
101
|
+
| Application name | UpperCamelCase | EmployeeService |
|
|
102
|
+
| Service name | lowercase, no hyphens | employee |
|
|
103
|
+
| Package path | com/qiwa/esb/<servicename>/ | com/qiwa/esb/employee/ |
|
|
104
|
+
|
|
105
|
+
## State Management & Properties
|
|
106
|
+
- Use `Environment.Variables` for intermediate state, API responses, database results, transfer types
|
|
107
|
+
- Access via REFERENCE TO: `DECLARE EV REFERENCE TO Environment.Variables;`
|
|
108
|
+
- Load properties from: `Environment.Properties.<ProjectName>.<FlowName>.Variables`
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
- Add inline comments for all business logic blocks explaining the business intent
|
|
112
|
+
- Change stamps format: `--- <Reason/Change> --- <Developer Name> <Date> ---`
|