The Managed Code session agent (SessionAgentCLR) is a development framework that enables custom functionality to be built on top of the pipeline using an object-oriented development language, such as C# or VB.NET. For example, Managed Code can be used to conduct external data lookups, develop custom data filters and transformations, or invoke external actions.
Managed Code allows access to the following external resources:
- Microsoft™ .NET class library
- COM objects
- External DLLs
Note: SessionAgentCLR requires version 1.1 or higher of Microsoft's .NET Framework. MS Visual Studio.NET 2003 or later is recommended for writing and debugging.
SessionAgentCLR uses the following procedure:
- Loads an instance of the Common Language Runtime.
- Compares source file(s) to the assembly
.DLL
. May be compiled if.DLL
is missing or source is newer. - Loads user assembly. Init method is called. The user code can do any needed global initialization here.
- Calls the ProcessHit method for each hit. The user code can modify or drop hit, or add new hit(s).
- Calls the Heartbeat method on each maintenance scan. Time-specific code can execute at this time.
- Calls the Cleanup method on pipeline teardown. The user code can perform global cleanup at this time.
Configuration Settings_c
The following configuration options are available:
- Display Name values are displayed in TMS, which is the recommended method for configuring session agents.
- Name values are displayed in
TealeafCaptureSocket.cfg
.
Display Name | Name | Description |
---|---|---|
Assembly DLL |
AssemblyDLL |
The name of the .DLL containing the session agent assembly (compiled session agent). This setting is also used to specify the output .DLL name if the CompileIfNeeded is set to True . |
Assembly Name |
AssemblyName |
Specifies the name of the assembly. Typically, it is the same value as AssemblyDLL, without the .DLL . |
Class Name |
ClassName |
The name of the class that implements the IHitHandler interface for the session agent. |
Compile If Needed |
CompileIfNeeded |
When set to True , the timestamps for all specified source files are compared with the timestamp for the assembly .DLL . If any source files have been modified or if the assembly .DLL doesn't yet exist, then the assembly for the session agent is compiled. This option should be set to False if the source file is not available on the server running this session agent. |
Debug |
Debug |
Specifies whether to build the session agent assembly in debug mode, if CompileIfNeeded=True . |
Assembly Base Path |
AssemblyBase |
This setting is used to specify the directory, relative to the Tealeaf install directory, to use as the base directory for searching for assembly DLLs that are not in the Global Access Cache (GAC). |
Log File |
LogFile |
Specifies the name and optional path, relative to the Tealeaf install directory, of a log file for the managed code session agent. Any trace methods called in the session agent code write to the specified log file, if appropriate for specified LogLevel. |
Log Level |
LogLevel |
The level of verbosity used when writing to the log file. Possible values are error , warn , info , debug or off . The default value is warn . |
Include Response |
IncludeResponse |
Specifies whether to pass the response to the hit handler in the session agent. If the response is not examined or modified by the session agent, then this value should be set to False to improve performance. |
Example Configuration
[Managed]
TypeName=Managed
DLL=SessionAgentCLR.dll
SourceFile=managed\source\testhandler.cs
AssemblyDLL=TestHandler.dll
AssemblyName=TestHandler
ClassName=TestHandler.TestClass
References=System.Data.dll, System.XML.dll
CompileIfNeeded=True
Debug=True
AssemblyBase=managed
HitObjectDLL=Tealeaf.Pipeline.dll
LogFile=managed\saclr.log
LogLevel=warn
DownStreamConfigSection=Null
# Add any additional config options here. They will be available to your code
# via the object.