How to use the amqpstorm.Message.create function in AMQPStorm

To help you get started, we’ve selected a few AMQPStorm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eandersson / amqpstorm / tests / message_tests.py View on Github external
def test_message_update_property_without_decode(self):
        message = Message.create(None, '', None)
        message._auto_decode = False
        message._update_properties('app_id', '123')
        self.assertEqual(message.properties['app_id'], '123')
        self.assertEqual(message._properties['app_id'], '123')
github eandersson / amqpstorm / tests / message_tests.py View on Github external
def test_message_delivery_mode_two(self):
        delivery_mode = 2

        message = Message.create(None, '')
        message.delivery_mode = delivery_mode

        self.assertEqual(delivery_mode, message.delivery_mode)
github eandersson / amqpstorm / tests / message_tests.py View on Github external
def test_message_priority_three(self):
        priority = 3

        message = Message.create(None, '')
        message.priority = priority

        self.assertEqual(priority, message.priority)
github eandersson / amqpstorm / tests / message_tests.py View on Github external
def test_message_reject_raises_on_outbound(self):
        message = Message.create(body='',
                                 channel=None)

        self.assertRaises(AMQPMessageError, message.reject)
github eandersson / amqpstorm / tests / functional_tests.py View on Github external
def setUp(self):
        self.connection = Connection(HOST, USERNAME, PASSWORD)
        self.channel = self.connection.channel()
        self.channel.queue.declare('test.basic.resend')
        self.channel.queue.purge('test.basic.resend')
        self.channel.confirm_deliveries()
        message = Message.create(self.channel,
                                 body=str(uuid.uuid4()))
        message.app_id = 'travis-ci'
        message.publish('test.basic.resend')
github eandersson / amqpstorm / examples / simple_rpc_server.py View on Github external
def on_request(message):
    number = int(message.body)

    print(" [.] fib(%s)" % (number,))

    response = str(fib(number))

    properties = {
        'correlation_id': message.correlation_id
    }

    response = Message.create(message.channel, response, properties)
    response.publish(message.reply_to)

    message.ack()
github eandersson / amqpstorm / examples / simple_rpc_server.py View on Github external
def on_request(message):
    number = int(message.body)

    print(" [.] fib(%s)" % (number,))

    response = str(fib(number))

    properties = {
        'correlation_id': message.correlation_id
    }

    response = Message.create(message.channel, response, properties)
    response.publish(message.reply_to)

    message.ack()
github eandersson / amqpstorm / examples / simple_rpc_client.py View on Github external
def call(self, number):
        self.response = None
        message = Message.create(self.channel, body=str(number))
        message.reply_to = self.callback_queue
        self.correlation_id = message.correlation_id
        message.publish(routing_key='rpc_queue')

        while not self.response:
            self.channel.process_data_events(to_tuple=False)
        return int(self.response)