// CFG: CRUNCHER-BUFFER-STACKER-CLASS
$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'FiFoStacker');
+// CFG: PRODUCER-OUTGOING-WORK-QUEUE
+$cfg->setConfigEntry('producer_outgoing_work_queue', 'FiFoStacker');
+
// CFG: STACKER-ANNOUNCEMENT-MAX-SIZE
$cfg->setConfigEntry('stacker_announcement_max_size', 20);
// CFG: STACKER-OBJECT-REGISTRY-MAX-SIZE
$cfg->setConfigEntry('stacker_object_registry_max_size', 100);
+// CFG: STACKER-WORK-QUEUE-MAX-SIZE
+$cfg->setConfigEntry('stacker_work_queue_max_size', 1000);
+
// CFG: NEWS-MAIN-LIMIT
$cfg->setConfigEntry('news_main_limit', 5);
* 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]