protected static function process_buffer() {
        // Reset the buffers first in case we get exception from processor.
        $messages = self::$buffer;
        self::$buffer = array();
        $convmessages = self::$convmessagebuffer;
        self::$convmessagebuffer = array();

        foreach ($messages as $message) {
            list($eventdata, $savemessage, $processorlist) = $message;
            self::send_message_to_processors($eventdata, $savemessage, $processorlist);
        }

        foreach ($convmessages as $convmessage) {
            list($eventprocmap, $eventdata, $savemessage) = $convmessage;
            self::send_conversation_message_to_processors($eventprocmap, $eventdata, $savemessage);
        }
    }