def callback(message): messages.append(message) raise exceptions.Drop()
def callback(message): """Drop 1 message and then halt on the second message.""" dropped_messages.append(message) if len(dropped_messages) == 2: raise exceptions.HaltConsumer() raise exceptions.Drop()