Contents

  1. Introduction
  2. evQueue
  3. evQueueCluster
  4. evQueueProxy

Introduction

These classes are made for an easy interaction with evQueue using PHP language.

Source code can be found in our sample project on GitHub.

Feel free to contribute with your own classes in any other language.

evQueue

The base class is used to access evQueue API and launch instances or query their status. For a list of available API commands, see API documentation.

Connecting to evQueue

To connect, you will need a connection string, a user and a password. Here is a simple example:

			$evq = new evQueue("tcp://localhost:5000","admin","admin");
		

This will connect to an evQueue node on localhost, port 5000.

Launching a new instance

Once you've created your workflow, you can launch a new instance from your PHP page:

			$instance_id = $evq->Launch("my_workflow",[],["parameter"=>"value"]);
		

Monitoring your instance

Once your instance is started, you can asynchronously monitor its status to display it to your users:

			$status = $evq->GetWorkflowStatus($instance_status);
		

Executing an API command

You can also use this class to send any API command:

			$result = $evq->API("workflows","list");
		

evQueueCluster

This is a wrapper class to evQueue that works in a clustered environement (High Availability). Instead of taking only one connection string, it also accepts an array of them, allowing to manipulated a cluster.

If a node fails, another one will automatically be requested.

To declare a new cluster:

			$cluster = new evQueueCluster([ "tcp://node1:5000", "tcp://node2:5000" ],"admin","admin");
		

Note that it is also valid to pass a single connection string so this class can be used exactly like the non clustered one.

When calling an API command, it is possible to give a specific node by its name (as configured in the cluster.node.name directive):

			$cluser->API("instance", "query", ["id" => $instance_id], [], "firstnode");
		

This API command will specifically be executed on the requested node. If the node is down, the command will fail. You can use the special node "*" to execute the command on all nodes.

evQueueProxy

This class is used as a proxy between the javascript API and evQueue core. It's based on the evQueueCluster class.

To declare a new proxy, create a dedicated PHP file and use something like this:

			(new evQueueProxy('tcp://localhost:5000','admin','admin'))->Run();
		

You can then use the javascript API by providing the URL of your PHP proxy (see sample project).