Abstract out PostgreSQL and AMQP related functionality to modules