added logic to clear the delivered / received / consumed flag for a message, if it is to be received into the next step