def cleanQueue(self, queue):
     stomp = Stomp(HOST, PORT)
     stomp.connect()
     stomp.subscribe(queue, {"ack": "client"})
     while stomp.canRead(1):
         frame = stomp.receiveFrame()
         stomp.ack(frame)
         print "Dequeued old message: %s" % frame
     stomp.disconnect()
 def cleanQueue(self, queue):
     stomp = Stomp('localhost', 61613)
     stomp.connect()
     stomp.subscribe(queue, {'ack': 'client'})
     while stomp.canRead(1):
         frame = stomp.receiveFrame()
         stomp.ack(frame)
         print "Dequeued old message: %s" % frame
     stomp.disconnect()        
Esempio n. 3
0
 def test_ack_writes_correct_frame(self):
     id = '12345'
     stomp = Stomp('localhost', 61613)
     stomp._checkConnected = Mock()
     stomp._write = Mock()
     stomp.ack({'cmd': 'MESSAGE', 'headers': {'message-id': id}, 'body': 'blah'})
     args,kargs = stomp._write.call_args
     sentFrame = self.parseFrame(args[0])
     self.assertEquals({'cmd': 'ACK',
                        'headers': {'message-id': id,
                                   },
                        'body': ''}, sentFrame)
 def test_integration(self):
     stomp = Stomp('localhost', 61613)
     stomp.connect()
     stomp.send(self.DEST, 'test message1')
     stomp.send(self.DEST, 'test message2')
     self.assertFalse(stomp.canRead(1))
     stomp.subscribe(self.DEST, {'ack': 'client'})
     self.assertTrue(stomp.canRead(1))
     frame = stomp.receiveFrame()
     stomp.ack(frame)
     self.assertTrue(stomp.canRead(1))
     frame = stomp.receiveFrame()
     stomp.ack(frame)
     self.assertFalse(stomp.canRead(1))
     stomp.disconnect()
def supportsClientIndividual():
    supported = False
    queue = '/queue/testClientAckMode'
    stomp = Stomp('localhost', 61613)
    stomp.connect()
    stomp.send(queue, 'test')
    stomp.subscribe(queue, {'ack': 'client-individual'})
    frame = stomp.receiveFrame()
    #Do not ACK.  If client-individual mode is supported, the messages will still be on the broker
    stomp.disconnect()
    stomp.connect()
    stomp.subscribe(queue, {'ack': 'client'})
    if stomp.canRead(1):
        frame = stomp.receiveFrame()
        stomp.ack(frame)
        supported = True
    stomp.disconnect()
    return supported
 def setUp(self):
     stomp = Stomp('localhost', 61613)
     stomp.connect()
     stomp.subscribe(self.DEST, {'ack': 'client'})
     while (stomp.canRead(1)):
         stomp.ack(stomp.receiveFrame())
Esempio n. 7
0
"""
Copyright 2011 Mozes, Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
"""
from stompest.simple import Stomp

QUEUE = '/queue/simpleTest'

stomp = Stomp('localhost', 61613)
stomp.connect()
stomp.subscribe(QUEUE, {'ack': 'client'})

while(True):
    frame = stomp.receiveFrame()
    print "Got message frame: %s" % frame
    stomp.ack(frame)
    
stomp.disconnect()