Configuration Elements
Use case:¶
Product Y and product Z are two multi-tenant solutions. Each has its own database(s) per customer/tenant.
Scenario 1: Product Y uses database YDB001 whereas product Z uses COMP-Z1 for this specific customer. Scenario 2: Customer has multiple databases in both products, each allocated for a location.
We have a customer X that needs to use both products. Both products will integrate using AIP. - Customer X is first provisioned in IAM and for simplicity is assigned COID of X. - Customer is then set up in product Y where its data is stored in database YDB001 and YDB002. - Customer is also set up in product Z where data is stored in database COMP-Z1 and COMP-Z2.
Both products contain vendor entity and product Z needs to sync with vendors from Y in both locations.
Product Y creates event definition "vendor-created-v1" using the following schema to send the event when a new vendor is added in its system:
{
"id": "string",
"name": "string"
}
Configuration mapping needs to be added in following scheme - example with customer X and another customer ABC with its products. Note that product y to z and z to y configurations are the same and should be specified only once.
| COID/TenantID | sourceProductId | targetProductId | sourceConfig | targetConfig |
|---|---|---|---|---|
| X | product y | product z | {"database":"ydb001"} | {"database":"comp-z1"} |
| X | product y | product z | {"database":"ydb002"} | {"database":"comp-z2"} |
| abc | m2m | eam | {"companyName":"c1", "facility":"LA"} | {"plant":"plant1", "database":"db-eam"} |
| abc | m2m | ship | {"companyName":"c1", "facility":"LA"} | {"tenantCode":"m2mabc", "companyName":"ship29", "locationId":"1824"} |
| abc | m2m | ship | {"companyName":"c2", "facility":"LA2"} | {"tenantCode":"m2mabc", "companyName":"ship29", "locationId":"1925"} |
Important: values are case-sensitive
*configuration values can be defined as simple strings, e.g. c1/LA, panlt1/db-eam, etc.
Sample 1:¶
Let's look at event flow for customer X: When new vendor is added in Product Y, following event is published:
{
"sourceTenantId": "X",
"sourceProductId": "Y",
"configuration": "{\"database\":\"ydb001\"}",
"eventType": "vendor-created-v1",
"payload": {
"id": "599",
"name": "Compusoft"}
}
AIP delivers the following payload to Product Z:
{
"configuration": "{\"database\":\"comp-z1\"}",
"eventType": "vendor-created-v1",
"payload": {
"id": "599",
"name": "Compusoft"}
}
There could indeed be another product listening to the same event with its own configuration if needed.
Sample 2:¶
Here's the event flow for customer ABC When order is ready in m2m, following event is published:
{
"sourceTenantId": "abc",
"sourceProductId": "m2m",
"configuration": "{\"companyName\":\"c1\", \"facility\":\"LA\"}",
"eventType": "shipment-readytoship-v1",
"payload": {
"shipment": {
"shipmentId": "056022",
"orderNumber": "031211",
"customFields": []}
},
}
AIP delivers the following payload to ship:
{
"sourceTenantId": "abc",
"sourceProductId": "m2m",
"configuration": "{\"tenantCode\":\"m2mabc\", \"companyName\":\"ship29\", \"locationId\":\"1824\"}",
"eventType": "shipment-readytoship-v1",
"payload": {
"shipment": {
"shipmentId": "056022",
"orderNumber": "031211",
"customFields": []}
},
}