// CFG: STACKER-PACKAGE-CHUNKED-DECODED-MAX-SIZE
$cfg->setConfigEntry('stacker_package_chunked_decoded_max_size', 800);
+// CFG: STACKER-PACKAGE-NEW-MESSAGE-MAX-SIZE
+$cfg->setConfigEntry('stacker_package_new_message_max_size', 400);
+
// CFG: STACKER-PACKAGE-BACKBUFFER-MAX-SIZE
$cfg->setConfigEntry('stacker_package_backbuffer_max_size', 1000);
function assembleDecodedDataToPackage ();
/**
- * Checks whether a new package has arrived
+ * Checks whether a new message has arrived
*
- * @return $hasArrived Whether a new package has arrived for processing
+ * @return $hasArrived Whether a new message has arrived for processing
*/
- function isNewPackageArrived ();
+ function isNewMessageArrived ();
+
+ /**
+ * Handle newly arrived message
+ *
+ * @return void
+ */
+ function handleNewlyArrivedMessage ();
/**
* Adds raw decoded data from the given handler instance to this receiver
*/
const STACKER_NAME_DECODED_CHUNKED = 'package_chunked_decoded';
+ /**
+ * Stacker name for new messages
+ */
+ const STACKER_NAME_NEW_MESSAGE = 'package_new_message';
+
/**************************************************************************
* Stacker for other/internal purposes *
**************************************************************************/
self::STACKER_NAME_DECODED_INCOMING,
self::STACKER_NAME_DECODED_HANDLED,
self::STACKER_NAME_DECODED_CHUNKED,
+ self::STACKER_NAME_NEW_MESSAGE,
self::STACKER_NAME_BACK_BUFFER
) as $stackerName) {
// Init this stacker
$this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_CHUNKED, $packageContent);
}
- /**
- * Checks whether a new package has arrived
- *
- * @return $hasArrived Whether a new package has arrived for processing
- */
- public function isNewPackageArrived () {
- // @TODO Add some content here
- }
-
/**
* Accepts the visitor to process the visit "request"
*
throw new InvalidDataChecksumException(array($this, $decodedContent, $decodedData), BaseListener::EXCEPTION_INVALID_DATA_CHECKSUM);
} // END - if
- // It is the same, then decompress it, the original message is than fully decoded
+ /*
+ * It is the same, then decompress it, the original message is than
+ * fully decoded.
+ */
$decodedContent[self::PACKAGE_CONTENT_MESSAGE] = $this->getCompressorInstance()->decompressStream($decodedContent[self::PACKAGE_CONTENT_MESSAGE]);
+
+ // And push it on the next stack
+ $this->getStackerInstance()->pushNamed(self::STACKER_NAME_NEW_MESSAGE, $decodedContent);
+ }
+
+ /**
+ * Checks whether a new message has arrived
+ *
+ * @return $hasArrived Whether a new message has arrived for processing
+ */
+ public function isNewMessageArrived () {
+ // Determine if the stack is not empty
+ $hasArrived = (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_NEW_MESSAGE));
+
+ // Return it
+ return $hasArrived;
+ }
+
+ /**
+ * Handles newly arrived messages
+ *
+ * @return void
+ */
+ public function handleNewlyArrivedMessage () {
+ // Get it from the stacker, it is the full array with the decoded message
+ $decodedContent = $this->getStackerInstance()->popNamed(self::STACKER_NAME_NEW_MESSAGE);
+
die('decodedContent='.print_r($decodedContent,true));
}
}
*/
public function executeTask () {
// Do we have something to handle?
- if ($this->getPackageInstance()->isNewPackageArrived()) {
- // Okay, then handle newly arrived package
- $this->getPackageInstance()->handleNewlyArrivedPackage();
+ if ($this->getPackageInstance()->isNewMessageArrived()) {
+ // Okay, then handle newly arrived message
+ $this->getPackageInstance()->handleNewlyArrivedMessage();
} elseif ($this->getPackageInstance()->isIncomingDecodedDataHandled()) {
/*
* We have handled decoded data so we should validate it, if we have