Backported from trunk (rev #9966):
event_rabbitmq: read/write commands only once
Thanks to Brett and Trevor for helping in debugging this
Closes bug report #361001