Kafka\Protocol\Encoder::_encodeFetchPartion PHP Method

_encodeFetchPartion() protected static method

encode signal part
protected static _encodeFetchPartion ( $values ) : string
return string
    protected static function _encodeFetchPartion($values)
    {
        if (!isset($values['partition_id'])) {
            throw new \Kafka\Exception\Protocol('given fetch data invalid. `partition_id` is undefined.');
        }
        if (!isset($values['offset'])) {
            $values['offset'] = 0;
        }
        if (!isset($values['max_bytes'])) {
            $values['max_bytes'] = 100 * 1024 * 1024;
        }
        $data = self::pack(self::BIT_B32, $values['partition_id']);
        $data .= self::pack(self::BIT_B64, $values['offset']);
        $data .= self::pack(self::BIT_B32, $values['max_bytes']);
        return $data;
    }

Usage Example

Beispiel #1
0
 /**
  * encodeFetchPartion
  *
  * @access public
  * @return void
  */
 public static function encodeFetchPartion($values)
 {
     return parent::_encodeFetchPartion($values);
 }