Adapter for Enterprise JavaBeans 6.5 SP3 | webMethods Adapter for Enterprise JavaBeans Documentation | webMethods Adapter for Enterprise JavaBeans Installation and User’s Documentation | Adapter Connections | Dynamically Changing a Service's Connection at Runtime
 
Dynamically Changing a Service's Connection at Runtime
You can run an adapter service using a connection other than the default connection that was associated with the service when the service was created. To override the default, 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 create an entity EJB on the production application server. However, you want the flow to have the capability to create the entity on the test server, with the decision of which application server 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, a CreateEJB 2.1 adapter service, would ignore $connectionName - thus using its default connection to create the EJB on the production server.
*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 server.
Keep in mind these restrictions when using dynamic connections:
*The EJB invoked by the CreateEJB 2.1 or FetchEJB 3.0 adapter service must be deployed on both application servers
*The default and override connections must be of the same type: EJB Non-Transactional, EJB Local, or EJB XA Connection
*The $connectionName field is present only in services created with Designer
For more information, see Changing the Connection Associated with an Adapter Service at Run Time.