Refactoring rabbitmq interface for make it more generic.