예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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')
예제 #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)