Remove code duplication from ListenBrainz's different modules
Don't Repeat Yourself is a principle in software development that all MetaBrainz projects try to follow as much as possible. Three different modules of ListenBrainz:
webserver connect to RabbitMQ using similar code.
This task involves consolidating this similar code into a function which should then get called by each module when it wants to connect to RabbitMQ.
influx-writerconnects to RabbitMQ in this file: https://github.com/metabrainz/listenbrainz-server/blob/master/listenbrainz/influx-writer/influx-writer.py#L55
bigquery-writerconnects to RabbitMQ in this file: https://github.com/metabrainz/listenbrainz-server/blob/master/listenbrainz/bigquery-writer/bigquery-writer.py#L41
webserverconnects to RabbitMQ in this file: https://github.com/metabrainz/listenbrainz-server/blob/master/listenbrainz/webserver/rabbitmq_connection.py#L8
To complete this task, you should add a function that connects to RabbitMQ in
listenbrainz/utils.py and call it in each of the above places, so that we only have
one piece of code to connect to RabbitMQ.