]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/producer/class_BaseProducer.php
Cruncher continued and rewritten to use states:
[hub.git] / application / hub / main / producer / class_BaseProducer.php
index 920c38b66f71b0fbad4a938fa7fba34dbdf50e00..af8cc7318a3116f8cd9cf68bbdf165f1fe7423ba 100644 (file)
  */
 abstract class BaseProducer extends BaseFrameworkSystem {
        /**
-        * Out-going work-queue
+        * Outgoing work-queue
         */
        private $outgoingQueueInstance = null;
 
+       /**
+        * Incoming raw data/items queue
+        */
+       private $incomingQueueInstance = null;
+
        /**
         * Protected constructor
         *
@@ -45,9 +50,18 @@ abstract class BaseProducer extends BaseFrameworkSystem {
        }
 
        /**
-        * Setter for out-going work queue
+        * Getter for outgoing work queue
         *
-        * @param       $outgoingQueueInstance  The out-going work queue instance
+        * @param       $outgoingQueueInstance  The outgoing work queue instance
+        */
+       protected final function getOutgoingQueueInstance () {
+               return $this->outgoingQueueInstance;
+       }
+
+       /**
+        * Setter for outgoing work queue
+        *
+        * @param       $outgoingQueueInstance  The outgoing work queue instance
         * @return      void
         */
        private final function setOutgoingQueueInstance (Stackable $outgoingQueueInstance) {
@@ -55,12 +69,22 @@ abstract class BaseProducer extends BaseFrameworkSystem {
        }
 
        /**
-        * Getter for out-going work queue
+        * Getter for incoming raw data/items queue
         *
-        * @param       $outgoingQueueInstance  The out-going work queue instance
+        * @param       $incomingQueueInstance  The incoming raw data/items queue instance
         */
-       protected final function getOutgoingQueueInstance () {
-               return $this->outgoingQueueInstance;
+       protected final function getIncomingQueueInstance () {
+               return $this->incomingQueueInstance;
+       }
+
+       /**
+        * Setter for incoming raw data/items queue
+        *
+        * @param       $incomingQueueInstance  The incoming raw data/items queue instance
+        * @return      void
+        */
+       private final function setIncomingQueueInstance (Stackable $incomingQueueInstance) {
+               $this->incomingQueueInstance = $incomingQueueInstance;
        }
 
        /**
@@ -71,20 +95,26 @@ abstract class BaseProducer extends BaseFrameworkSystem {
        abstract protected function initProducer();
 
        /**
-        * Initializes the work queue which is being used for out-going, produced
+        * Initializes the work queue which is being used for outgoing, produced
         * items.
         *
         * @return      void
         */
        protected function initWorkQueue () {
                // Get an instance and set it in this producer
-               $this->setOutgoingQueueInstance(ObjectFactory::createObjectByConfiguredName('producer_outgoing_work_queue'));
+               $this->setOutgoingQueueInstance(ObjectFactory::createObjectByConfiguredName('producer_outgoing_queue'));
+
+               // Init the queue
+               $this->getOutgoingQueueInstance()->initStacker('outgoing_queue');
+
+               // Get an instance and set it in this producer
+               $this->setOutgoingQueueInstance(ObjectFactory::createObjectByConfiguredName('producer_incoming_queue'));
 
                // Init the queue
-               $this->getOutgoingQueueInstance()->initStacker('work_queue');
+               $this->getOutgoingQueueInstance()->initStacker('incoming_queue');
 
                // Debug message
-               $this->debugOutput('PRODUCER: Out-going work queue initialized.');
+               $this->debugOutput('PRODUCER: All queues have been initialized.');
        }
 }