Adapter for IBM Power 10.11 | Adapter for IBM Power Connections | Dynamically Changing a Service's Connection at Run Time
 
Dynamically Changing a Service's Connection at Run Time
You can run a service using a connection other than the default connection that was associated with the service when the service was created.
To override the default connection, you must code your flow to pass a value through the pipeline into a service's $connectionName field.
For example, you have a flow whose primary purpose is to update a production dataqueue. However, you want the flow to have the capability to update a test dataqueue, with the decision of which dataqueue to update to be made programmatically at runtime. The output signature of the flow's first service contains a field called Target. The flow could branch based on the value in Target. If Target contains the value Production, the second service in the flow would ignore $connectionName, thus using its default connection to connect to (and then update) the production dataqueue. However, if Target contains the value Test, the second service in the flow would use the value in the $connectionName from the pipeline and connect to (and then update) the test dataqueue.
Keep in mind these restrictions when using dynamic connections:
*Both connections, the default and override, must use the same dataqueue structure.
*The connection with which you override the default (that is, the value provided for $connectionName) must be configured to use the same service type as the default connection.
For more information, see Changing the Connection Associated with an Adapter Service at Run Time.