scope is a distinguished request parameter that is used in routing decisions. It is similar to
labels in that it determines the target Data Access Processes (DAPs) that service the request (see routing and labels), but it differs in that it also influences which Resource Coordinator (RC) is chosen by the Gateway (GW).
scope parameter is specified in the request arguments as a dictionary. The keys in the dictionary determine which RC the GW chooses and which DAPs the RC ultimately chooses.
||Assembly to target.|
Assembly and global resource coordinators
RCs deployed as part of an assembly are considered assembly RCs. RCs deployed in the base insights install are considered global RCs.
Gateway to Resource Coordinator
scope parameter is specified in the request arguments, e.g.
gw:hopen`:gateway_host:1234 # Open connection to GW gw(`.kxi.getData;`table`scope!(`myTable;enlist[`assembly]!enlist`myAssembly);`;()!()) # Target "myAssembly"
If specified, the GW attempts to send to an RC in the specified assembly. If no RC in the specified assembly is found, then the GW does one of two things based on the value of the
KXI_SCOPE_AFFINITY environment variable.
KXI_SCOPE_AFFINITY="hard"(default), then the request fails immediately with a "No resources connected" error.
KXI_SCOPE_AFFINITY="soft", then the GW sends to a global RC, and that RC is then responsible for routing to DAPs of the correct assembly.
If the scope parameter is not specified in the request arguments, then the GW targets one of the global RCs.