// CFG: NODE-RAW-DATA-STACKER-CLASS
$cfg->setConfigEntry('node_raw_data_stacker_class', 'FiFoStacker');
+// CFG: CHUNK-HANDLER-STACKER-CLASS
+$cfg->setConfigEntry('chunk_handler_stacker_class', 'FiFoStacker');
+
// CFG: PRODUCER-OUTGOING-QUEUE
$cfg->setConfigEntry('producer_outgoing_queue', 'FiFoStacker');
// CFG: STACKER-PACKAGE-HANDLED-DECODED-MAX-SIZE
$cfg->setConfigEntry('stacker_package_handled_decoded_max_size', 200);
+// CFG: STACKER-FINAL-CHUNKS-MAX-SIZE
+$cfg->setConfigEntry('stacker_final_chunks_max_size', 100);
+
// CFG: NEWS-MAIN-LIMIT
$cfg->setConfigEntry('news_main_limit', 5);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ChunkHandler extends BaseHandler implements Registerable {
+ /**
+ * Stacker for chunks with final EOP
+ */
+ const STACKER_NAME_CHUNKS_WITH_FINAL_EOP = 'final_chunks';
+
/**
* Protected constructor
*
// Set handler name
$this->setHandlerName('chunk');
+
+ // Get a FIFO stacker
+ $stackerInstance = ObjectFactory::createObjectByConfiguredName('chunk_handler_stacker_class');
+
+ // Init all stacker
+ $stackerInstance->initStacker(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP);
+
+ // Set the stacker in this handler
+ $this->setStackerInstance($stackerInstance);
}
/**
throw new FinalChunkVerificationException(array($this, $chunks), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
} // END - if
- // Not yet finished
- $this->partialStub('Not yet implemented.');
+ // Add all chunks to the FIFO stacker
+ foreach ($chunk as $chunk) {
+ // Add the chunk
+ $this->getStackerInstance()->pushNamed(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP, $chunk);
+ } // END - foreach
}
}