Example #1
0
 def test_get_msg(self):
     body = b'test-body'
     name = 'queue-name-get'
     rabbitpy.create_queue(queue_name=name)
     rabbitpy.publish(routing_key=name, body=body)
     result = rabbitpy.get(queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(queue_name=name)
Example #2
0
 def test_get_msg(self):
     body = b'test-body'
     name = 'queue-name-get'
     rabbitpy.create_queue(queue_name=name)
     rabbitpy.publish(routing_key=name, body=body)
     result = rabbitpy.get(queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(queue_name=name)
Example #3
0
 def test_get_msg(self):
     body = b'test-body'
     name = 'queue-name-get'
     rabbitpy.create_queue(os.environ['RABBITMQ_URL'], queue_name=name)
     rabbitpy.publish(os.environ['RABBITMQ_URL'], routing_key=name, body=body)
     result = rabbitpy.get(os.environ['RABBITMQ_URL'], queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(os.environ['RABBITMQ_URL'], queue_name=name)
Example #4
0
 def test_publish_with_confirm(self):
     body = b'test-body'
     name = 'simple-publish'
     rabbitpy.create_queue(queue_name=name)
     self.assertTrue(rabbitpy.publish(routing_key=name, body=body,
                                      confirm=True))
     result = rabbitpy.get(queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(queue_name=name)
Example #5
0
 def test_publish_with_confirm(self):
     body = b'test-body'
     name = 'simple-publish'
     rabbitpy.create_queue(queue_name=name)
     self.assertTrue(
         rabbitpy.publish(routing_key=name, body=body, confirm=True))
     result = rabbitpy.get(queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(queue_name=name)
Example #6
0
 def test_get_msg(self):
     body = b'test-body'
     name = 'queue-name-get'
     rabbitpy.create_queue(os.environ['RABBITMQ_URL'], queue_name=name)
     rabbitpy.publish(os.environ['RABBITMQ_URL'],
                      routing_key=name,
                      body=body)
     result = rabbitpy.get(os.environ['RABBITMQ_URL'], queue_name=name)
     self.assertEqual(result.body, body)
     rabbitpy.delete_queue(os.environ['RABBITMQ_URL'], queue_name=name)
Example #7
0
 def test_get_empty(self):
     name = 'queue-name-get'
     rabbitpy.create_queue(queue_name=name)
     self.assertIsNone(rabbitpy.get(queue_name=name))
     rabbitpy.delete_queue(queue_name=name)
Example #8
0
 def test_get_empty(self):
     name = 'queue-name-get'
     rabbitpy.create_queue(os.environ['RABBITMQ_URL'], queue_name=name)
     self.assertIsNone(
         rabbitpy.get(os.environ['RABBITMQ_URL'], queue_name=name))
     rabbitpy.delete_queue(os.environ['RABBITMQ_URL'], queue_name=name)
Example #9
0
 def test_get_empty(self):
     name = 'queue-name-get'
     rabbitpy.create_queue(queue_name=name)
     self.assertIsNone(rabbitpy.get(queue_name=name))
     rabbitpy.delete_queue(queue_name=name)
import rabbitpy

message = rabbitpy.get(queue_name='mqtt-messages')
if message:
    message.pprint(True)
    message.ack()
else:
    print('No message in queue')
Example #11
0
 def test_get_empty(self):
     name = 'queue-name-get'
     rabbitpy.create_queue(os.environ['RABBITMQ_URL'], queue_name=name)
     self.assertIsNone(
         rabbitpy.get(os.environ['RABBITMQ_URL'], queue_name=name))
     rabbitpy.delete_queue(os.environ['RABBITMQ_URL'], queue_name=name)