A
A
Alexander2020-11-04 17:42:28
1C-Bitrix
Alexander, 2020-11-04 17:42:28

How to specify an agent for a module?

I am writing a module and it is necessary that after installing the module, an agent is created,
it will run a function that accesses the infoblocks API at a specified frequency and imports data from an external source into the infoblock.

How can I specify in the settings of my module that when it is installed, an agent is created that will start after the required amount of time?
And where to place the agent code itself in the module structure?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Gritsuk, 2020-11-04
@winer

An agent can be added using the CAgent::AddAgent
method. A call to this method can be placed in the install/index.php of the module.

And where to place the agent code itself in the module structure

For example, in the lib folder inside the module in one of the classes. In general, wherever it is convenient for you

Y
Yaroslav Alexandrov, 2020-11-05
@alexyarik

Add the InstallAgent function to install/index.php with the required parameters CAgent::AddAgent
https://admin4web.ru/blog/moduli/avtomaticheski-so...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question