/**
  * Gets agent name. Use to return this name from the executed method of agent.
  *
  * Usage:
  * ```php
  * public function executeAgent($param1, $param2)
  * {
  *      // main logic
  *
  *      return $this->getAgentName(['executeAgent => [$param1, $param2]]);
  * }
  * ```
  *
  * @param array $callChain Array with the call any methods from Agent class.
  *
  * @return string
  */
 public function getAgentName(array $callChain)
 {
     return AgentHelper::createName(get_called_class(), static::$constructorArgs, $callChain);
 }
Exemple #2
0
 /**
  * Create agent in Bitrix queue.
  *
  * @param bool $checkExist Return false and set `CAdminException`, if agent already exist.
  *
  * @return bool|int ID of agent or false if `$checkExist` is true and agent already exist.
  */
 public function create($checkExist = false)
 {
     $this->convertation();
     $model = new \CAgent();
     return $model->AddAgent(AgentHelper::createName($this->class, $this->constructorArgs, $this->callChain), $this->module, $this->periodically, $this->interval, null, $this->active, $this->executionTime, $this->sort, $this->userId, $checkExist);
 }