Using TCP Adapters with Ensemble
Special Topics
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

This chapter discusses the following additional topics:

For general information on customizing the callback methods of adapters, see Less Common Tasks in Developing Ensemble Productions.
Tip:
Ensemble also provides specialized business service classes that use TCP adapters, and one of those might be suitable for your needs. If so, no programming would be needed. See Connectivity Options in Introducing Ensemble.
Adding a TCP Status Service
The EnsLib.TCP.StatusService class parses an incoming text string to determine what type of production status information is being requested, and then produces a reply string suitable for writing out to the console screen. A user can interact with the status service directly, or write a command script that contacts the status service, issues commands, and writes the replies to a text file for later analysis.
A developer enables interactions via the status service as follows:
  1. Add an instance of EnsLib.TCP.StatusService to the production.
  2. Configure the instance of EnsLib.TCP.StatusService to accept communications via a particular TCP port. Set a Port number and a list of Allowed IP Addresses from which to accept connections. These are only two of the several settings that are available to configure the TCP text line inbound adapter associated with the status service. For details, see Reference for Settings.”
Once you have completed these steps, any time the status service is enabled and running, a user or command-line script can initiate a Telnet connection to the configured Port and send commands to the status service. Each command must be a text string that ends with the newline character (ASCII 10). The reply strings will also terminate with a newline.
The following table describes the supported command lines and the contents of the text string returned in each case.
Command Line Text String Returned
build The full name of the Ensemble software version, for example Cache for Windows (x86-32) 2007.1.2 (Build 514U) Mon Aug 13 2007 11:30:37 EDT
configitemstatus name
When you enter this command with the configured name of any business host in the currently running production, the status service returns a string that expresses the current state of that business host.
A host that has currently running jobs, or active connections, records those activities in the returned string. If the identified host is not a member of the currently running production, the returned string indicates this.
exit No string is returned. This command disconnects from the status service. You may enter x instead of exit
localstarttime If Ensemble is running, this returns the start time of the currently running production, expressed in local time coordinates. Otherwise, it returns a string with the message <UNDEFINED>
localtime The current time, in local time coordinates.
namespace The Ensemble namespace where the currently running production resides.
production The configured name of the currently running production.
quit No string is returned. This command disconnects from the status service. You may enter q instead of quit
utcstarttime If Ensemble is running, this returns the start time of the currently running production, is expressed in universal time coordinates (UTC). Otherwise, it returns a string with the message <UNDEFINED>
utctime The current time, in universal time coordinates (UTC).
version The abbreviated name of the Ensemble software version, for example 2007.1.0.514/2171
x Same as exit
Creating Custom TCP Adapter Classes
To create a custom subclass of a TCP adapter class, do the following in Studio:
  1. On the File menu, click New, and then click the General tab.
  2. Start the New Class Wizard by clicking Caché Class Definition and clicking OK.
    1. Enter a package and class name and click Next.
      Important:
      Be sure to avoid reserved package names; see Reserved Package Names in Developing Ensemble Productions.
    2. Click Extends for the Class type.
    3. Click Browse next to Name of super class and navigate to the class that you want to subclass.
    4. Click OK.
    5. Click Finish.
    The result is a template class like the following, depending on the class you chose:
    Class MyTest.NewClass1 Extends EnsLib.TCP.InboundAdapter
    {
    
    }
  3. You can override any property, method, class parameter, or other class member inherited from the class or its parent classes, or you can add new class members. The only requirements are as follows:
  4. Compile the class, which also saves it.
Common Customizations in TCP Adapter Subclasses
The following list suggests some common customizations in TCP adapter subclasses, in addition to implementing the methods that the adapter needs: