Пример #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_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)
Пример #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_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)
Пример #7
0
 def test_publish_with_confirm(self):
     body = b'test-body'
     name = 'simple-consume-tests'
     rabbitpy.create_queue(queue_name=name)
     self.assertTrue(rabbitpy.publish(routing_key=name, body=body,
                                      confirm=True))
     for message in rabbitpy.consume(queue_name=name, no_ack=True):
         self.assertEqual(message.body, body)
         break
     rabbitpy.delete_queue(queue_name=name)
Пример #8
0
 def test_publish_with_confirm(self):
     body = b'test-body'
     name = 'simple-consume-tests'
     rabbitpy.create_queue(queue_name=name)
     self.assertTrue(
         rabbitpy.publish(routing_key=name, body=body, confirm=True))
     for message in rabbitpy.consume(queue_name=name, no_ack=True):
         self.assertEqual(message.body, body)
         break
     rabbitpy.delete_queue(queue_name=name)
Пример #9
0
import rabbitpy

for iteration in range(10):
    rabbitpy.publish('amqp://*****:*****@localhost:5672/%2f', '',
                     'test-messages', 'go')
rabbitpy.publish('amqp://*****:*****@localhost:5672/%2f', '', 'test-messages',
                 'stop')
Пример #10
0
def publish_message(message, queue_name='hello'):
    if API_KEY:
        rabbitpy.publish(API_KEY, exchange_name='', routing_key=queue_name, body=message)
        return True
    else:
        return False
Пример #11
0
def publish_message(message, queue_name='hello'):
    rabbitpy.publish(API_KEY, exchange_name='', routing_key=queue_name, body=message)
import rabbitpy

for iteration in range(10):
    rabbitpy.publish('amqp://*****:*****@localhost:5672/%2f', '', 'test-messages', 'go')
rabbitpy.publish('amqp://*****:*****@localhost:5672/%2f', '', 'test-messages', 'stop')