
Hi, On 25.07.2016 10:02, Juan Manuel Clavero Almirón wrote:
Hi all,
I have an event module that takes too much time so the user response time is ridiculous. I was thinking of creating a new asynchronous task from the event and then run the actions on the background.
I’ve been reading the OTRS 5.0 dev manual : it refers to the task handler and shows a test module located in Kernel/Scheduler/TaskHandler/Test.pm, but my OTRS install doesn’t have any Scheduler folder.
The admin manual refers to the OTRS Daemon, new feature in OTRS 5, and I’ve located some modules in the System folder, but I cannot find any document on how to create a new process for the daemon.
https://otrs.github.io/doc/manual/developer/stable/en/html/architecture-over... talks about $OTRS_HOME/Kernel/Scheduler/TaskHandler/GenericInterface.pm, but I think the proper location is $OTRS_HOME/Kernel/System/Daemon/DaemonModules/SchedulerTaskWorker/GenericInterface.pm But I don't think you have to actually touch any of the DaemonModules, the existing AsynchronousExecutor should do just fine.
Can anybody refer to some guide or explain how to register a new asynchronous task?
Here is an example of a task that is being executed asynchronously: https://github.com/OTRS/otrs/blob/43abbee47642a486177bb4ffe39c3677bdcaca52/K... So one thing you could do is to write an ordinary, synchronous event that, like the example above, calls TaskAdd with Type => 'AsynchronousExecutor' on a Kernel::System::Scheduler object. And another function which does the slow work you need to do, and then the Scheduler executes that for you in the background. Of course, that's all a very indirect way to approach that (but one that works without patching OTRS itself). I'd rather see a patch to Kernel::System::EventHandler that directly supports asynchronous execution, so that you could get rid of a writing a synchronous event that just triggers an asynchronous task. Best regards, Moritz