Programmatically Direct Tasks to a Specific Runtime Pool
Technical Note USA12002Created 19-Dec-2005Applies To
Synapta Services Builder for 3270 & 5250
Goal
Programmatically Direct Tasks to a Specific Runtime PoolProgrammatically Direct Tasks to Different Telnet Servers or Telnet ServicesProgrammatically Direct Tasks to Different Hosts
Fix
Note: If round-robin Task redirection and/or Runtime Failover is also required, then the Agent Clustering mechanism should be used. For more information on Agent Clustering, refer to "Task Failover and Load Balancing" in the Help documentation.One can programmatically direct Tasks to differing Telnet Servers (or Services or Hosts). This is a three-step process and can be accomplished as follows:
1. In the MCS Console, create a Runtime pool for each Telnet Server (or Services or Hosts) that you need to connect to. Each pool will reference the same NavMap but will be configured to connect to a different Host. For example:
Pool Name Host IP or Alias NavMap
--------------------- ----------------------- --------------------
MyProject 192.168.1.100 MyProject
newpoolname 192.168.1.200 MyProject
2. Two different methods are available here. One uses Agent Clustering (the preferred method), the other uses TaskConfigurations.xml. Note that a client application will try and use the Agent Clustering mechanism first. If, for some reason, Agent Clustering has not been configured (or not correctly configured), then the client will use the information in TaskConfigurations.xml to find the appropriate Runtime Server/Pool.
To use the Agent Clustering mechanism:
Note: If you're not already familiar with the Agent Clustering mechanism, and how to configure this mechanism, then please refer to "Task Failover and Load Balancing" in the Help documentation.
In MCS, under Products ==> Services Builder for Screens ==> Deployments ==> Tasks ==> Registered Runtimes, create an entry for each Runtime server, where the "Pool name:" field is set to the value of any non-default pool name. For example, you will see something like this in the Registered Runtime configuration window when you're finished:
rmi://localhost:6700
rmi://localhost:6700/?contextName=newpoolname
Where the Runtime Server is installed on the machine named "localhost".
Note that, if preferred, you could explicitly set the pool name for all pools, for example:
rmi://localhost:6700/?contextName=MyProject
rmi://localhost:6700/?contextName=newpoolname
To use the TaskConfigurations.xml methodology:
In the TaskConfigurations.xml file, add a corresponding configuration entry for each new pool created. In the following example, a configuration has been added for the pool named "newpoolname", where the Runtime is installed on the server named "localhost":
<Configuration Name = "newpoolname" >
<Property Name = "serverAddress" Value = "localhost/?contextName=newpoolname" />
<Property Name = "serverClass" Value = "com.attachmate.common.eai.ProxyTaskServer" />
<Property Name = "port" Value = "6700" />
<Property Name = "server" Value = "localhost" />
</Configuration>
For more information on the TaskConfigurations.xml file, please refer to the Help documentation.
Important: If you are using .NET Web Services, then in order for the above changes to take affect, you must first c.ycle the "ScreenConnectorProxyService" Windows Service prior to executing any Tasks.
3. When executing a Task, set the Task's ResourceName value to match the name of the pool to execute against. For example:
When using the Java Beans, use the setResourceName() method as follows:
MyTaskName myBean = new MyTaskName();
myBean.setResourceName( "newpoolname" );
When using the IConnectorAccess interface, include the <ResourceName> Element and value in the ScreenInputs XML:
IConnectorAccess conn = new ScreenConnectorAccessImpl();
. . .
conn.open( taskFile );
conn.execute( taskName, "<ScreenInputs><ResourceName>newpoolname</ResourceName><Input>myTaskInput</Input></ScreenInputs>" );
When using an Attachmate Designer Studio generated .NET Web Service, set the ResourceName field in the ScreenInputs object reference:
MyProjectNameService webService = new MyProjectNameService();
MyTaskNameScreenInputs inputs = new MyTaskNameScreenInputs();
inputs.ResourceName = "newpoolname";
...
MyTaskNameScreenOutputs outputs = webService.MyTaskName( inputs );
Additional Notes: The IConnectorAccess interface is the underlying API for the COM bridges (ScreenConnector.dll & ScreenConnectorProxyService). The ScreenConnectorProxyService is the default COM bridge used in the Attachmate Designer-generated Microsoft .NET Web Services..