From fe5f126ee57b412aceac8092683fd48fb746a3e9 Mon Sep 17 00:00:00 2001 From: Addison Klinke Date: Wed, 10 Apr 2019 09:26:27 -0600 Subject: [PATCH 1/2] add PHP beanstalk example --- ...ntegration.include => app_integration.rst} | 50 ++++++++++++++++++- source/on_premises.rst | 2 +- 2 files changed, 50 insertions(+), 2 deletions(-) rename source/{app_integration.include => app_integration.rst} (90%) diff --git a/source/app_integration.include b/source/app_integration.rst similarity index 90% rename from source/app_integration.include rename to source/app_integration.rst index d50b8f4..5a238b9 100644 --- a/source/app_integration.include +++ b/source/app_integration.rst @@ -53,7 +53,7 @@ In addition, you must add a valid on-premises license to /etc/openalpr/license.c Once updated, restart the OpenALPR agent service to allow the settings to take effect. -Below is a sample Python script that pulls results from the local Beanstalkd queue: +Below are sample scripts in Python and PHP that pull results from the local Beanstalkd queue: .. code-block:: python @@ -109,6 +109,54 @@ Below is a sample Python script that pulls results from the local Beanstalkd que # Delete the job from the queue when it is processed. job.delete() +.. code-block:: php + listTubes()); + echo "\r\n\r\n----End of Tube List----\r\n\r\n"; + + //Watch the alprd-alt tube + $pheanstalk->watch('alprd-alt'); + + //Print the tubes statistics + echo "----Tube Statistics----\r\n\r\n"; + var_dump($pheanstalk->statsTube('alprd-alt')); + echo "\r\n\r\n----End of Tube Statistics----\r\n\r\n"; + + //Do this forever + while(true){ + try{ + //Reserve a job off the queue + $job = $pheanstalk->reserve(); + } + + catch(Exception $e){ + //If we get an exception just keep going + continue; + } + + //If the job is NULL then there is nothing to do + if($job == NULL){ + echo "Nothing for us to do right meow. Just chill. \r\n"; + } + + else{ + //Otherwise we have a job ready to process + echo "There is something in the job queue. Get to work! \r\n"; + echo "----Job Data----\r\n\r\n"; + echo $job->getData() . "\r\n\r\nJob ID:" . $job->getId() . "\r\n\r\n"; + echo "----End of Job Data ----\r\n\r\n"; + } + } + ?> JSON Plate Results ------------------------- diff --git a/source/on_premises.rst b/source/on_premises.rst index 4d1925b..04c7372 100644 --- a/source/on_premises.rst +++ b/source/on_premises.rst @@ -344,7 +344,7 @@ Web Server Application Integration ======================== -.. include:: app_integration.include +.. include:: app_integration.rst .. _video_processing: From d310a3baeca18eeafa2a953989474bce5f731664 Mon Sep 17 00:00:00 2001 From: Addison Klinke Date: Wed, 10 Apr 2019 09:35:22 -0600 Subject: [PATCH 2/2] formatting code block --- source/app_integration.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/source/app_integration.rst b/source/app_integration.rst index 5a238b9..d1c138d 100644 --- a/source/app_integration.rst +++ b/source/app_integration.rst @@ -110,6 +110,7 @@ Below are sample scripts in Python and PHP that pull results from the local Bean job.delete() .. code-block:: php +