Beispiel #1
0
    def process(self, channel, method, header, body):
        """Process a message received from RabbitMQ.

        :param channel: the channel the message was received on
        :type channel: :class:`pika.channel.Channel`

        :param method: the method frame
        :type method: :class:`pika.frame.Method`

        :param header: the header frame
        :type header: :class:`pika.frame.Header`

        :param body: the message body
        :type body: str

        """
        message = Message(channel, method, header, body)
        log.debug('Received message #%s', message.delivery_tag)
        log.debug('Message body: %s', message.body)
        if self._process(message):
            if self._ack:
                self.acknowledge(message)
Beispiel #2
0
 def execute(self):
     self.message = Message(sentinel.channel, self.method, self.header,
                            sentinel.body)
Beispiel #3
0
 def configure(self):
     self.header = NonCallableMagicMock(content_type='application/json')
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #4
0
 def configure(self):
     self.header = NonCallableMagicMock(content_encoding='gzip')
     self.body = NonCallableMagicMock()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            self.body)
Beispiel #5
0
 def configure(self):
     self.header = NonCallableMagicMock()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #6
0
 def configure(self):
     self.ctx.datetime.now.return_value = datetime(2009, 2, 13, 18, 32, 30)
     self.header = NonCallableMagicMock()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #7
0
 def configure(self):
     self.header = NonCallableMagicMock()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
     self.message.properties = NonCallableMagicMock(expiration=None)
Beispiel #8
0
 def configure(self):
     self.ctx.datetime.fromtimestamp.return_value = sentinel.created_at
     self.header = NonCallableMagicMock()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #9
0
 def should_return_expected_payload(self, name, headers, body, expected):
     self.header = BasicProperties(**headers)
     message = Message(sentinel.channel, sentinel.method, self.header, body)
     self.assertEqual(message.payload, expected)
Beispiel #10
0
 def configure(self):
     self.ctx.datetime.now.return_value = datetime(2009, 2, 13, 18, 32, 30)
     self.header = BasicProperties(timestamp='1234567890',
                                   expiration='60000')
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #11
0
 def configure(self):
     self.header = BasicProperties()
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)
Beispiel #12
0
 def configure(self):
     self.header = BasicProperties(timestamp='1234567890')
     self.message = Message(sentinel.channel, sentinel.method, self.header,
                            sentinel.body)