Refactor RabbitMQ functionality