Prepare instance template files
When preparing an instance specific template file, keep in mind that you will use some of the identifiers that point to the shared template file. It is highly recommended to prepare your shared template first.
In this file you need to provide configuration blocks for the DataSource used by this instance, Topology information, QueryViews, etc. You can identify them in your export .stj file by identifier with instance entry, for example "urn:stackpack:{{StackPackName}}:instance:{{instanceId}}:sync:test". However, this file also requires pointers to functions, Component templates, and Relation templates from the shared template file as in the below example:
Also, in this file you need to provide mapping functions called componentActions from the shared-template file to execute on the instance nodes:

Synchronizations and componentActions mappings

1
{
2
"_type": "Sync",
3
"name": "Test",
4
"identifier": "urn:stackpack:{{StackPackName}}:instance:{{instanceId}}:sync:test",
5
"relationActions": [],
6
"extTopology": -142,
7
"topologyDataQuery":
8
{
9
"_type": "Sts.StsTopologyElementsQuery",
10
"relationIdExtractorFunction": {{get "urn:stackpack:{{StackPack name}}:shared:idextractor-function:test-relation-id-extractor"}},
11
"componentIdExtractorFunction": {{get "urn:stackpack:{{StackPack name}}:shared:idextractor-function:test-component-id-extractor"}},
12
"id": -191,
13
"consumerOffsetStartAtEarliest": false
14
},
15
"componentActions":
16
[
17
{
18
"_type": "SyncActionCreateComponent",
19
"templateFunction": {{get "urn:stackpack:{{StackPackName}}:shared:component-template-function:exchange-service-template"}},
20
"id": -190,
21
"mergeStrategy": "MergePreferTheirs",
22
"type": "exchange_service"
23
}
24
],
25
"id": -2,
26
"defaultComponentAction":
27
{
28
"_type": "SyncActionCreateComponent",
29
"templateFunction": {{get "urn:stackpack:{{StackPackName}}:shared:component-template-function:exchange-component-template"}},
30
"id": -1,
31
"mergeStrategy": "MergePreferTheirs",
32
"type": "default_component_mapping"
33
},
34
"defaultRelationAction":
35
{
36
"_type": "SyncActionCreateRelation",
37
"templateFunction": {{get "urn:stackpack:{{StackPackName}}:shared:relation-template-function:test-relation-template"}},
38
"id": -188,
39
"mergeStrategy": "MergePreferTheirs",
40
"type": "default_relation_mapping"
41
}
42
},
Copied!
After getting Synchronizations and Mappings from the shared-template into your instance-specific file, you can start looking for instance-specific blocks in the STJ export and copy them to your instance-specific template. You can quickly identify instance specific blocks, as their Identifier contains instance:{{instanceId}} segment.

DataSources

1
{
2
"_type": "DataSource",
3
"name": "test",
4
"identifier": "urn:stackpack:{{StackPackName}}:instance:{{instanceId}}:data-source:test",
5
"pluginId": "Sts",
6
"config": {
7
"expireElementsAfter": 172800000,
8
"_type": "Sts.StsTopologyDataSourceConfig",
9
"autoExpireElements": false,
10
"id": -143,
11
"supportedWindowingMethods": [],
12
"integrationType": "test",
13
"supportedDataTypes": ["TOPOLOGY_ELEMENTS"],
14
"topic": "{{ topicName }}"
15
},
16
"id": -140,
17
"uiRequestTimeout": 15000
18
},
Copied!

Topology Information

1
"extTopology": {
2
"_type": "ExtTopology",
3
"dataSource": -140,
4
"id": -142,
5
"settings": {
6
"_type": "TopologySyncSettings",
7
"cleanupInterval": 3600000,
8
"maxBatchesPerSecond": 5,
9
"id": -141,
10
"maxBatchSize": 200,
11
"cleanupExpiredElements": false
12
}
13
},
Copied!

QueryViews

1
{
2
"_type": "QueryView",
3
"name": "TEST - {{instance_url}}",
4
"query": "(domain IN (\"TEST\"))",
5
"minimumGroupSize": 8,
6
"groupedByDomains": true,
7
"id": -72,
8
"identifier": "urn:stackpack:{{StackPackName}}:instance:{{instanceId}}:query-view:test",
9
"groupedByLayers": true,
10
"showIndirectRelations": false,
11
"groupingEnabled": true,
12
"queryVersion": "0.0.1"
13
}
Copied!

Example of an instance template file:

1
{
2
"nodes":
3
[
4
{
5
"_type": "Sync",
6
"name": "sync-Name",
7
"identifier": "urn:stackpack:{{StackPack Name}}:instance:{{instanceId}}:sync:{{sync-name}}",
8
"relationActions": [],
9
"extTopology": -142,
10
"topologyDataQuery":
11
{
12
"_type": "Sts.StsTopologyElementsQuery",
13
"relationIdExtractorFunction": {{get "urn:stackpack:{{StackPack Name}}:shared:idextractor-function:relation-id-extractor"}},
14
"componentIdExtractorFunction": {{get "urn:stackpack:{{StackPack Name}}:shared:idextractor-function:component-id-extractor"}},
15
"id": -191,
16
"consumerOffsetStartAtEarliest": false
17
},
18
"componentActions":
19
[
20
{
21
"_type": "SyncActionCreateComponent",
22
"templateFunction": {{get "urn:stackpack:{{StackPack Name}}:shared:component-template-function:exchange-service-template"}},
23
"id": -190,
24
"mergeStrategy": "MergePreferTheirs",
25
"type": "exchange_service"
26
}
27
],
28
"id": -2,
29
"defaultComponentAction":
30
{
31
"_type": "SyncActionCreateComponent",
32
"templateFunction": {{get "urn:stackpack:{{StackPack Name}}:shared:component-template-function:exchange-component-template"}},
33
"id": -1,
34
"mergeStrategy": "MergePreferTheirs",
35
"type": "default_component_mapping"
36
},
37
"defaultRelationAction":
38
{
39
"_type": "SyncActionCreateRelation",
40
"templateFunction": {{get "urn:stackpack:{{StackPack Name}}:shared:relation-template-function:relation-template"}},
41
"id": -188,
42
"mergeStrategy": "MergePreferTheirs",
43
"type": "default_relation_mapping"
44
}
45
},
46
{
47
"_type": "DataSource",
48
"name": "datasource",
49
"identifier": "urn:stackpack:{{StackPack Name}}:instance:{{instanceId}}:data-source:{{datasource}}",
50
"pluginId": "Sts",
51
"config":
52
{
53
"expireElementsAfter": 172800000,
54
"_type": "Sts.StsTopologyDataSourceConfig",
55
"autoExpireElements": false,
56
"id": -143,
57
"supportedWindowingMethods": [],
58
"integrationType": "{type}",
59
"supportedDataTypes": ["TOPOLOGY_ELEMENTS"],
60
"topic": "{{ topicName }}"
61
},
62
"extTopology":
63
{
64
"_type": "ExtTopology",
65
"dataSource": -140,
66
"id": -142,
67
"settings":
68
{
69
"_type": "TopologySyncSettings",
70
"cleanupInterval": 3600000,
71
"maxBatchesPerSecond": 5,
72
"id": -141,
73
"maxBatchSize": 200,
74
"cleanupExpiredElements": false
75
}
76
},
77
"id": -140,
78
"uiRequestTimeout": 15000
79
},
80
{
81
"_type": "QueryView",
82
"name": "ViewName - {{instance_url}}", "query": "(domain IN (\"TEST\"))",
83
"minimumGroupSize": 8,
84
"groupedByDomains": true,
85
"id": -72,
86
"identifier": "urn:stackpack:{{StackPack Name}}:instance:{{instanceId}}:query-view:test",
87
"groupedByLayers": true,
88
"showIndirectRelations": false,
89
"groupingEnabled": true,
90
"queryVersion": "0.0.1"
91
}
92
],
93
"timestamp": "2019-05-31T18:03:38Z",
94
"version": "0.1"
95
}
Copied!
Last modified 11d ago