Saltar para o conteúdo principal
Versão: 20 R7 BETA

Process activity

Process activity () : Object
Process activity ( options ) : Object
Process activity ( sessionID ) : Object
Process activity ( sessionID ; options ) : Object

ParâmetroTipoDescrição
sessionIDTextSession ID
optionsIntegerReturn options
ResultadoObjectSnapshot of running processes and/or (4D Server only) user sessions
História
ReleaseMudanças
20 R7Support of sessionID parameter

Descrição

The Process activity command returns a snapshot of running processes and/or (4D Server only) connected user sessions at a given time.The Process activity command returns a snapshot of running processes and/or (4D Server only) connected user sessions at a given time. This command returns all processes, including internal processes that are not reachable by the Process info command.

By default when used without any parameters, Process activity returns an object containing the following properties:

  • "processes", a collection of all processes
  • "sessions" (4D Server only), a collection of all sessions

On 4D Server, you can filter information to be returned using the optional sessionID and options parameters:

  • If you pass a user session ID in the sessionID parameter, the command only returns information related to this session. By default if the options parameter is omitted, the returned object contains a collection with all processes related to the session and a collection with a single object describing the session. If you pass an invalid session ID, a null object is returned.
  • You can select the collection(s) to return by passing one of the following constants in the options parameter:
ParâmetrosValorComentário
Processes and sessions0Returns both "processes" and "sessions" lists (default value)
Processes only1Returns only the "processes" list
Somente sessões2Returns only the "sessions" list
nota

When executed on 4D in remote or local mode, Process activity always returns the list of running processes (sessionID and options parameters are ignored).

Sessions

The "sessions" property contains a collection of objects describing all running sessions on the server. For a description of session object properties, please refer to the Session info command.

Notes
  • You can get the object of a session using the Session command.
  • Process activity returns remote client sessions, stored procedure session and rest sessions but not Web sessions (limitation).

Processes

The "processes" property contains a collection of process objects describing all running processes. For a description of process object properties, please refer to the Process info command.

On the server, the Process activity command returns an additional "session" property:

Additional propertyTipoDescrição
sessionObjectThe .info property of the session in which the process is running. Undefined if the Processes only parameter is passed.

Exemplo 1

You want to get the collection of all user sessions:

  //To be executed on the server
 
 var $o : Object
 var $i : Integer
vat $processName;$userName : Text

 
$o:=Process activity //Get process & session info
For($i;0;($o.processes.length)-1) //Iterate over the "processes" collection
$processName:=$o.processes[$i].name
$userName:=String($o.processes[$i].session.userName) // Easy access to userName
//use String because session object might be undefined
End for

Exemplo 2

You want to get all processes related to the current session:

  // to be executed on the server

var $sessionID : Text:=Session.id
var $o : Object

$o:=Process activity($sessionID ;Processes only)

Veja também

Session storage
WEB Get server info