Flush Sessions

This section describes how to flush aggregation sessions in real-time and batch workflows.

The following functions for Aggregation flush described here are:



Real-Time Aggregation APL Flush Function

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.



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.



Example - command block in Aggregation agent

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); }



Using Workflow Monitor

To access the Command tab, you will have to access the Agent Status dialog from the Workflow Monitor. Select the Aggregation agent from the Workflow Monitor and click on the icon that appears above the agent. 

Aggregation agent in Workflow Monitor - Agent Status Button

Aggregation agent in Workflow Monitor - Command tab



Parameter

Description

Parameter

Description

Only session with timeout

Trigger a flush for sessions that have already timeout.

All sessions

Trigger a flush for all sessions, regardless if they have already timeout or not.

instruction

This is an optional string used only when there is a command function block defined within the Aggregation agent. If specified, the string will trigger the command function block in the Aggregation agent through the instruction variable. Refer to the example above and to Variables for further information.

Using MZSH Syntax

Syntax to run the command function block from mzsh:

$ mzsh wfcommand <Workflow Name> <Agent Name> <"true"|"false"> <instruction>





Parameter

Description

Parameter

Description

Workflow Name

The name of the workflow that contains the Aggregation agent

Agent Name

The name of the Aggregation agent in the workflow

"true"|"false"

Specifies what sessions to apply the command block for. true means apply on all sessions, while false means apply only on sessions with timeout set. To have the sessions removed, the command block must issue sessionRemove(session).

instruction

This is an optional string. If specified, the string will be available within the command function block in the Aggregation agent through the instruction variable. Refer to Variables for further information.



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.

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

Parameter

Description

aggregationAgentName

The name of an Aggregation agent in the batch workflow