* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseProducer extends BaseFrameworkSystem {
+ /**
+ * Out-going work-queue
+ */
+ private $outgoingQueueInstance = null;
+
/**
* Protected constructor
*
// Initialize all producers
$this->initProducer();
+
+ // Initialize work queue (out-going, produced items)
+ $this->initWorkQueue();
+ }
+
+ /**
+ * Setter for out-going work queue
+ *
+ * @param $outgoingQueueInstance The out-going work queue instance
+ * @return void
+ */
+ private function setOutgoingQueueInstance (Stackable $outgoingQueueInstance) {
+ $this->outgoingQueueInstance = $outgoingQueueInstance;
+ }
+
+ /**
+ * Getter for out-going work queue
+ *
+ * @param $outgoingQueueInstance The out-going work queue instance
+ */
+ protected function getOutgoingQueueInstance () {
+ return $this->outgoingQueueInstance;
}
/**
* @return void
*/
abstract protected function initProducer();
+
+ /**
+ * Initializes the work queue which is being used for out-going, produced
+ * items.
+ *
+ * @return void
+ */
+ protected function initWorkQueue () {
+ // Get an instance and set it in this producer
+ $this->setOutgoingQueueInstance(ObjectFactory::createObjectByConfiguredName('producer_outgoing_work_queue'));
+
+ // Init the queue
+ $this->getOutgoingQueueInstance()->initStacker('work_queue');
+
+ // Debug message
+ $this->debugOutput('PRODUCER: Out-going work queue initialized.');
+ }
}
// [EOF]