Contents

  1. Introduction
  2. Base principles
  3. Going further

Introduction

In the user documentation you have seen how to create workflows and eventually schedule them to run at specific times. This is a standalone usage of evQueue but you can do much more by integrating it as a service for your frontend.

You might already have encoutered this situation: a web page needs to do some complexe task, like resizing images or doing some complex calculations. You can write the code in your web page, but it is not very satisfactory: if the treatment is too long you get timeouts and the user have very slow pages that looks buggy.

To overcome this "webserver" limitation you can execute these tasks in evQueue and provide your users a nice asynchronous reporting (ajax) of what is going on.

Base principles

For achieving this, you need to interconnect your web pages with evQueue. This can be done by several means, like using the CLI or using our PHP classes.

For the moment, we only provide PHP classes, but you can write your own API interface. The communication protocol is text based and uses simple XML commands so you should be able to write it quite simply.

The base principle is always the same: instead of writing your code in the page that needs it, you will write a workflow to handle the task. The web page simply launches a new instances and stores the instance ID (in a server session or javascript local storage). You can then query the instance status and display it to your user.

As instance execution is asynchronous, you have no more timeouts problems. Furthermore, the user has an indication of tasks progression. You can even launch multiple instances and display their status.

Using queues allows you to limit the consumed resources of your overall system and prevent system slowdown when many users launch tasks simultaneously.

Going further

Now you might want to have a look at the PHP classes we provide to see how this all works.

We also provide a sample PHP project as a demonstration of these concepts.