Skip to content

Commit

Permalink
Merge pull request #46 from mokshaproject/auto-mean-nope
Browse files Browse the repository at this point in the history
Don't ack if the ack mode is 'auto'.
  • Loading branch information
ralphbean committed Jun 26, 2017
2 parents a9f9ae3 + e49b2bc commit ef01ed3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions moksha.hub/moksha/hub/stomp/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ def connectionMade(self):
log.debug(cmd)
self.transport.write(cmd)


def ack(self, msg):
""" Override stomper's own ack to be smarter, based on mode. """
# stomper does the incorrect thing when the ack mode is auto. It acks
# every message, regardless of the mode. However, if the mode is
# 'auto', then we should *not* send acks. Here, make sure we don't
# send an ack in that mode.
if self.client.hub.config.get('stomp_ack_mode', 'auto') == 'auto':
return stomper.NO_REPONSE_NEEDED

# Otherwise, do what stomper do if the mode is *not* auto.
return super(StompProtocol, self).ack(msg)

def dataReceived(self, data):
"""Data received, react to it and respond if needed """
self.buffer.appendData(data)
Expand Down

0 comments on commit ef01ed3

Please sign in to comment.