Ensure that we don't get stuck with a bad message

If a bad JSON message is receive, the begin/rescue will be executed
without acknowledging handling of this (bad) result. So we move it out
of the begin/resue block to make sure we do ACK.
Merge pull request #790 from bencaron/fix_json_with_errors

Ensure that we don't get stuck with a bad message in queue