def testAck(self): messageid = '1234' transactionid = '9876' header = 'message-id: %s\ntransaction: %s' % (messageid, transactionid) correct = "ACK\n%s\n\n\x00\n" % header self.assertEquals(stomper.ack(messageid, transactionid), correct) messageid = '1234' correct = "ACK\nmessage-id: %s\n\n\x00\n" % messageid self.assertEquals(stomper.ack(messageid), correct)
def testAck(self): subscription = '1' messageid = '1234' transactionid = '9876' header = 'subscription:%s\nmessage-id:%s\ntransaction:%s' % ( subscription, messageid, transactionid) correct = "ACK\n%s\n\n\x00\n" % header actual = stomper.ack(messageid, subscription, transactionid) self.assertEquals(actual, correct) subscription = '1' messageid = '1234' correct = "ACK\nsubscription:%s\nmessage-id:%s\n\n\x00\n" % ( subscription, messageid) self.assertEquals(stomper.ack(messageid, subscription), correct)
def _ack(self, messageId): """Send ack command """ self.log.debug("Sending ack command for message: %s" % messageId) cmd = stomper.ack(messageId) # self.log.debug("Writing cmd: %s" % cmd) self.transport.write(cmd)
def ack(self, msg): message_id = msg['headers']['message-id'] subscription = msg['headers']['subscription'] transaction_id = None if msg['headers'].has_key('transaction-id'): transaction_id = msg['headers']['transaction-id'] #self.log("MSG Body: %s"%(msg['body'])) #self.log("acknowledging message id <%s>." % (message_id)) self._send(stomper.ack(message_id, subscription, transaction_id)) return msg