event queueing

padams edited this page Feb 28, 2016 · 2 revisions

Activating Event Queuing

To activate event queuing define the OWA_QUEUE_EVENTS constant in your owa-config.php file like so:

define('OWA_QUEUE_EVENTS', true);

Incoming Tracking Event Queue

New tracking events recorded by log.php will be written to an events.txt file in the owa-data/logs/ directory. Queue Types

The Incoming Tracking Event Queue implementation is plug-able. There are currently two implementations of this event queue: file (which is the default) and http. The file implementation is a simple log file, while the http implementation will post the event to the queue.php of another instance of OWA running on a remote host. Remote (http) Event Queuing

It is sometimes preferable to offload the logging of events to a different server or even a different PHP process on the same server in order to avoid slowing down the main user initiated php process that is serving your pages. When enabled OWA will POST all incoming tracking events to another remote instance of OWA running on a different host.

To enable http event queuing you must activate the "Remote Queue" module via the Admin > Settings > Modules screen and define an endpoint in your owa-config.php file like so:

$this->setSetting( 'remoteQueue', 'endpoint', 'http://domain/path/to/owa/queue.php');

The Processing Queue

OWA uses a second event queue called "processing" for persisting secondary events that need to be retried at a later time. This queue is used typical needed in cases where there are multiple OWA logging instances setup to write to the same database. In this case it is likely that tracking events for a angle user session could be recorded across multiple servers and processed out of order. OWA processing assumes eventual consistency and the Processing stores is used to store out of order events so they can be retried at a later date. Processing the Queues

The event queue can be processed by invoking OWA's comand line interface like so:

/path/to/php5 cli.php cmd=processEventQueue

You will want to use cron to call this as often as you need to in order to avoid the event queue getting too large. See Event processing for more details.