Constructor
new Agent()
Creates a new Agent with a unique identifier and
initialized wire-contract properties.
The Agent is initially asynchronous and contains no
visitor routing information or application data.
Classes
Members
KEY_DELIMITER :string
Delimiter used when constructing compound data keys.
Matches the Java Agent.KEY_DELIMITER constant.
Type:
- string
apiClassName :string|null
Logical API class name used to identify the
receiving API.
Type:
- string | null
creationTimeStamp :number
Agent creation time, expressed as milliseconds
since the Unix epoch.
Type:
- number
data :Object.<string, *>|null
Application-defined key/value data associated
with this Agent.
Type:
- Object.<string, *> | null
latencyRecord :LatencyRecord|null
Latency measurements associated with this Agent.
Type:
- LatencyRecord | null
sizeInBytes :number
Serialized Agent size in bytes.
Initially zero until populated by the
serialization process.
Type:
- number
synchronous :boolean
Indicates whether the Agent uses synchronous
request/reply processing.
Type:
- boolean
uuid :string
Unique identifier assigned to this Agent.
Type:
- string
visitorMethodName :string|null
Name of the visitor method to invoke on the
receiving endpoint.
Type:
- string | null
Methods
getData(key) → {*}
Retrieves an application-defined value associated
with the specified key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Non-empty key identifying the data value. |
Throws:
-
-
If key is not a non-empty string.
- Type
- TypeError
-
-
-
If the data map is empty or the key does not exist.
- Type
- Error
-
Returns:
Value associated with the specified key.
- Type
- *
hasData(key) → {boolean}
Determines whether the Agent contains a value
associated with the specified key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Non-empty key to check. |
Throws:
-
If key is not a non-empty string.
- Type
- TypeError
Returns:
True if the key exists; otherwise false.
- Type
- boolean
setData(key, value) → {Agent}
Associates an application-defined value with a key.
If the data map does not exist, it is created.
An existing value associated with the same key
is replaced.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Non-empty key identifying the data value. |
value |
* | Application-defined value to store. |
Throws:
-
If key is not a non-empty string.
- Type
- TypeError
Returns:
This Agent for method chaining.
- Type
- Agent
setVisitorMethod(visitorMethodName, apiClassName) → {Agent}
Configures the visitor method and API class name
used to dispatch this Agent.
Both arguments must be non-empty strings.
Parameters:
| Name | Type | Description |
|---|---|---|
visitorMethodName |
string | Name of the visitor method to invoke. |
apiClassName |
string | Logical name of the receiving API class. |
Throws:
-
If either argument is not a non-empty string.
- Type
- TypeError
Returns:
This Agent for method chaining.
- Type
- Agent