10.07.2015 Views

Using TCP Adapters with Ensemble - InterSystems Documentation

Using TCP Adapters with Ensemble - InterSystems Documentation

Using TCP Adapters with Ensemble - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating Custom <strong>TCP</strong> Adapter Classes• An outbound adapter class define methods that create a <strong>TCP</strong> connection, read or write over the connection, anddisconnect.To define these methods, use helper methods inherited by your class.4. Compile the class, which also saves it.8.2 Common Customizations in <strong>TCP</strong> Adapter SubclassesThe following list suggests some common customizations in <strong>TCP</strong> adapter subclasses, in addition to implementing themethods that the adapter needs:• The Terminators property is a common property to edit. You can specify an initial expression for this property.Your adapter class can set a value for Terminators using the ObjectScript function $CHAR or $C to identify the ASCIIvalue for the character. The following example from EnsLib.<strong>TCP</strong>.TextLineInboundAdapter sets Terminators to thenewline character (ASCII 10):Property Terminators As %String [ InitialExpression = {$C(10)} ];For more information about functions like $CHAR, see “Caché ObjectScript Functions” in the Caché ObjectScriptReference.You can set Terminators to a single character or to a multi-character string. If you supply a string for the Terminatorsvalue, <strong>Ensemble</strong> uses the string as follows:– Any one of the characters in the string serves to terminate the input.– The complete string of characters is appended to the output.• You can expose additional properties for runtime configuration by providing a SETTINGS parameter whose value isa comma-separated list of the properties that you want to expose. For example:/// The full pathname for a transaction log file on the local computerProperty LogPath As %String(MAXLEN = 200) [ Required ];/// The simple file name for the logProperty LogSpec As %String(MAXLEN = 60) [ InitialExpression = "*" ];/// These properties are exposed for runtime configuration via the portalParameter SETTINGS = "LogPath,LogSpec";At runtime, properties from this SETTINGS list appear in the display on the [<strong>Ensemble</strong>] > [Production Configuration]page as additional settings.• If you need to require login credentials for the connection, simply add the property name Credentials to theSETTINGS list. The Credentials property is already defined as a %String in the base class Ens.Adapter.For background information, see “Username and Password Credentials” in the chapter “Production Concepts” inDeveloping <strong>Ensemble</strong> Productions.• (For inbound adapters) You can also enforce a pool size of 1 by setting the parameter SINGLEPOOLJOB = 1:/// Force a single listener job regardless of PoolSize settingParameter SINGLEPOOLJOB = 1;Any subclass of this adapter class or a business service class that uses such an adapter class can use this parameter inits class code to better control the pool size.52 <strong>Using</strong> <strong>TCP</strong> <strong>Adapters</strong> <strong>with</strong> <strong>Ensemble</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!