Example #1
0
    def _read_frame(self):
        """Try and read from the frame buffer and decode a frame.

        :rtype tuple: (int, pika.frame.Frame)

        """
        return frame.decode_frame(self._frame_buffer)
Example #2
0
    def _read_frame(self):
        """Try and read from the frame buffer and decode a frame.

        :rtype tuple: (int, pika.frame.Frame)

        """
        return frame.decode_frame(self._frame_buffer)
Example #3
0
 def _run0(self):
     (_frame_type, _channel, _payload, read_frame_buffer) = self._connection.read_frame()
     _consumed_count, frame_value = frame.decode_frame(read_frame_buffer)
     if isinstance(frame_value, frame.Heartbeat):
         LOGGER.debug("receive heartbeat")
     elif isinstance(frame_value, frame.Method) and (isinstance(frame_value.method, spec.Basic.Ack) or
                                                         isinstance(frame_value.method, spec.Basic.Ack)):
         # for In publisher-acknowledgments mode
         self._connection.deliver_pub_ack(frame_value)
     else:
         self._connection.deliver_frame(frame_value)
Example #4
0
 def decode_body_frame_fragment_consumed_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.BODY_FRAME)[0], 28)
Example #5
0
 def decode_frame_decoding_failure_test(self):
     self.assertEqual(
         frame.decode_frame(b'\x01\x00\x01\x00\x00\xce'), (0, None))
Example #6
0
 def decode_body_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BODY_FRAME)[1], frame.Body)
Example #7
0
 def decode_method_frame_method_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BASIC_ACK)[1].method, spec.Basic.Ack)
Example #8
0
 def decode_header_frame_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.CONTENT_HEADER)[0], 23)
Example #9
0
 def decode_protocol_header_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.PROTOCOL_HEADER)[0], 8)
Example #10
0
 def decode_protocol_header_failure_test(self):
     self.assertEqual(frame.decode_frame(b'AMQPa'), (0, None))
Example #11
0
 def decode_method_frame_method_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BASIC_ACK)[1].method, spec.Basic.Ack)
Example #12
0
 def decode_header_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.CONTENT_HEADER)[1], frame.Header)
Example #13
0
 def decode_protocol_header_failure_test(self):
     self.assertEqual(frame.decode_frame(b'AMQPa'), (0, None))
Example #14
0
 def decode_method_frame_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.BASIC_ACK)[0], 21)
Example #15
0
 def decode_method_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BASIC_ACK)[1], frame.Method)
Example #16
0
 def decode_protocol_header_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.PROTOCOL_HEADER)[0], 8)
Example #17
0
 def decode_protocol_header_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.PROTOCOL_HEADER)[1], frame.ProtocolHeader)
Example #18
0
 def decode_heartbeat_frame_bytes_consumed_test(self):
     self.assertEqual(frame.decode_frame(self.HEARTBEAT)[0], 8)
Example #19
0
 def decode_header_frame_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.CONTENT_HEADER)[0], 23)
Example #20
0
 def decode_protocol_header_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.PROTOCOL_HEADER)[1], frame.ProtocolHeader)
Example #21
0
 def decode_header_frame_properties_test(self):
     frame_value = frame.decode_frame(self.CONTENT_HEADER)[1]
     self.assertIsInstance(frame_value.properties, spec.BasicProperties)
Example #22
0
 def decode_method_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BASIC_ACK)[1], frame.Method)
Example #23
0
 def decode_frame_decoding_failure_test(self):
     self.assertEqual(frame.decode_frame(b'\x01\x00\x01\x00\x00\xce'),
                      (0, None))
Example #24
0
 def decode_method_frame_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.BASIC_ACK)[0], 21)
Example #25
0
 def decode_frame_decoding_no_end_byte_test(self):
     self.assertEqual(frame.decode_frame(self.BASIC_ACK[:-1]), (0, None))
Example #26
0
 def decode_header_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.CONTENT_HEADER)[1], frame.Header)
Example #27
0
 def decode_body_frame_instance_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.BODY_FRAME)[1], frame.Body)
Example #28
0
 def decode_header_frame_properties_test(self):
     frame_value = frame.decode_frame(self.CONTENT_HEADER)[1]
     self.assertIsInstance(frame_value.properties, spec.BasicProperties)
Example #29
0
 def decode_body_frame_fragment_consumed_bytes_test(self):
     self.assertEqual(frame.decode_frame(self.BODY_FRAME)[0], 28)
Example #30
0
 def decode_frame_decoding_no_end_byte_test(self):
     self.assertEqual(frame.decode_frame(self.BASIC_ACK[:-1]), (0, None))
Example #31
0
 def decode_heartbeat_frame_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.HEARTBEAT)[1], frame.Heartbeat)
Example #32
0
 def decode_body_frame_fragment_test(self):
     self.assertEqual(
         frame.decode_frame(self.BODY_FRAME)[1].fragment,
         self.BODY_FRAME_VALUE)
Example #33
0
 def decode_heartbeat_frame_bytes_consumed_test(self):
     self.assertEqual(frame.decode_frame(self.HEARTBEAT)[0], 8)
Example #34
0
 def decode_body_frame_fragment_test(self):
     self.assertEqual(
         frame.decode_frame(self.BODY_FRAME)[1].fragment,
         self.BODY_FRAME_VALUE)
Example #35
0
 def decode_heartbeat_frame_test(self):
     self.assertIsInstance(
         frame.decode_frame(self.HEARTBEAT)[1], frame.Heartbeat)