Exemplo n.º 1
0
    def setup(self, transporter_args):
        send_queue_suffix = transporter_args.get("amqp_send_queue_suffix", "-S")
        recv_queue_suffix = transporter_args.get("amqp_recv_queue_suffix", "-T")
        suffix_map = {transporter.DIR_SEND: send_queue_suffix,
                      transporter.DIR_RECV: recv_queue_suffix}
        suffix = suffix_map.get(transporter_args["direction"], "")

        if "amqp_hapi_queue" not in transporter_args:
            transporter_args["amqp_hapi_queue"] = transporter_args["amqp_queue"]
        transporter_args["amqp_queue"] = \
            transporter_args["amqp_hapi_queue"] + suffix
        RabbitMQConnector.setup(self, transporter_args)
Exemplo n.º 2
0
    def test_run_receive_loop(self):
        class Receiver():
            def __call__(self, channel, msg):
                self.msg = msg
                channel.stop_consuming()

        TEST_BODY = "FOO"
        self.__delete_test_queue()
        conn = RabbitMQConnector()
        conn.setup(self.__get_default_transporter_args())
        receiver = Receiver()
        conn.set_receiver(receiver)
        self.__publish(TEST_BODY)
        conn.run_receive_loop()
        self.assertEquals(receiver.msg, TEST_BODY)
    def test_run_receive_loop(self):
        class Receiver():
            def __call__(self, channel, msg):
                self.msg = msg
                channel.stop_consuming()

        TEST_BODY = "FOO"
        self.__delete_test_queue()
        conn = RabbitMQConnector()
        conn.setup(self.__get_default_transporter_args())
        receiver = Receiver()
        conn.set_receiver(receiver)
        self.__publish(TEST_BODY)
        conn.run_receive_loop()
        self.assertEquals(receiver.msg, TEST_BODY)
Exemplo n.º 4
0
 def __connect(self):
     conn = RabbitMQConnector()
     conn.setup(self.__get_default_transporter_args())
     return conn
 def __connect(self):
     conn = RabbitMQConnector()
     conn.setup(self.__get_default_transporter_args())
     return conn
Exemplo n.º 6
0
 def test_setup(self):
     conn = RabbitMQConnector()
     conn.setup(self.__get_default_transporter_args())