Aggregation Flush Sessions(3.0)
This section describes how to flush aggregation sessions in real-time and batch workflows.
command - Real-Time Only
To flush Real-time workflow sessions, run an agent command from the Command Tab of the Aggregation agent in the Workflow Monitor or use the Command Line Tool mzsh. There is a choice of applying the command on all sessions or only on those with a timeout set. There is also an option of attaching information in a string to be available within the command function block in the Aggregation agent.
Note!
You cannot flush sessions that are stored in Couchbase.
Syntax to run the command
function block from mzsh
:
$ mzsh wfcommand <Workflow Name> <Agent Name> <"true"|"false"> <instruction>
Note!
The command function block works in the same way as the timeout function block, that is, code has to be written to route the session result and to remove the session.
Syntax to run the command function block from mzsh:
$ mzsh wfcommand <Workflow Name> <Agent Name> <"true"|"false"> <instruction>
Parameter | Description |
---|---|
| The name of the workflow that contains the Aggregation agent |
| The name of the Aggregation agent in the workflow |
| Specifies what sessions to apply the |
| This is an optional string. If specified, the string will be available within the |
Example - Using command
A simple APL example of command
:
command { OutputUDR finalUDR = udrCreate( OutputUDR ); finalUDR.user = session.user; finalUDR.IPAddress = (string)session.IPAddress; finalUDR.downloadedBytes = session.downloadedBytes; finalUDR.uploadedBytes = session.uploadedBytes; if (instruction == "extra") { finalUDR.extraBytes = session.extraBytes; } udrRoute( finalUDR ); sessionRemove(session); }
Batch Aggregation APL Flush Function
This section describes the APL function aggregationHintFlushSessions
, which is used to timeout all stored sessions that have a timeout value in a batch Aggregation agent. The function is included in the package Batch Aggregation APL Flush Function.
The APL function aggregationHintFlushSessions
may be called from Analysis APL code or Aggregation APL code in batch workflows.
The function is used to indicate that the timeout
function block in the APL code for the specified Aggregation agent shall be called for all the sessions in the storage that have a timeout value. The timeout
block execution will be performed after the drain
function block has been executed in the specified Aggregation agent. The call to the function will not be remembered between batches.
Note!
Only sessions that have a timeout value will timeout even if the function aggregationHintFlushSessions
has been called. To make sure that all sessions have a timeout value, set the Aggregation agent property If Timeout is Missing to Default or Abort. The Aggregation agent property If Timeout is Missing can be found under the tab called General in the Aggregation agent configuration.
When executed, the function will throw an exception if it is called from an illegal location or if the agent named aggregationAgentName
is not an Aggregation agent in the workflow.
Function Definition:
void aggregationHintFlushSessions(string aggregationAgentName )
Parameter | Description |
---|---|
| The name of an Aggregation agent in the batch workflow |
Example - Using aggregationHintFlushSessions
For example, consider a batch workflow containing one Aggregation agent named "Agg" which has the Aggregation agent property If Timeout is Missing set to Default. Also, consider that the beginBatch
function block and the timeout
function block in the APL code for the Aggregation agent are defined as in the following code:
beginBatch { aggregationHintFlushSessions("Agg"); } timeout { sessionRemove(session); }
Finally, consider that there are 10 sessions, with timeout values in the distant future, in the storage when the end of the drain
function block in the Aggregation agent has been reached. Then the timeout
function block will be executed 10 times, one time for every session in the storage, and thus all the sessions in the storage will be removed.
Note!
A workflow using aggregationHintFlushSession
may get stuck in a loop if all sessions are not removed in the timeout
block.