amqp refactoring