def _publish_message(self, task_id, response_queue):
     start_msg = StateChangeMessage(task_id, TaskCondition.START)
     message = pack_message(start_msg)
     self.channel.basic_publish(message,
                                mandatory=True,
                                exchange=response_queue,
                                routing_key=response_queue)
Beispiel #2
0
 def _publish_message(self, task_id, response_queue):
     start_msg = StateChangeMessage(task_id, TaskCondition.START)
     message = pack_message(start_msg)
     self.channel.basic_publish(message,
                                mandatory = True,
                                exchange = response_queue,
                                routing_key = response_queue)
Beispiel #3
0
 def test_command_message(self):
     cmd_msg = CommandMessage(["echo", "hello world"], 
                               "response_queue", "task_id", 
                               xml_file = StringIO("foo bar")) 
     packed_msg = pack_message(cmd_msg)
     rec_msg = unpack_message(packed_msg)
     self.assertEquals("echo hello world", rec_msg.command)
     self.assertEquals("response_queue", rec_msg.response_queue)
     self.assertEquals("task_id", rec_msg.task_id)
     self.assertTrue(isinstance(rec_msg.xml_file, StringIO))
     self.assertEquals(ots.common.__VERSION__, rec_msg.__version__)
Beispiel #4
0
 def test_command_message(self):
     cmd_msg = CommandMessage(["echo", "hello world"],
                              "response_queue",
                              "task_id",
                              xml_file=StringIO("foo bar"))
     packed_msg = pack_message(cmd_msg)
     rec_msg = unpack_message(packed_msg)
     self.assertEquals("echo hello world", rec_msg.command)
     self.assertEquals("response_queue", rec_msg.response_queue)
     self.assertEquals("task_id", rec_msg.task_id)
     self.assertTrue(isinstance(rec_msg.xml_file, StringIO))
     self.assertEquals(ots.common.__VERSION__, rec_msg.__version__)