Write a non-blocking Tornado application according to the following info.
- consume messages (content type "application/json") from RabbitMQ and store them in MongoDB
- provide websocket endpoint that publishes incoming messages to websocket clients as they arrive from RabbitMQ
- the routing key format is
{collection}.{_id}
denoting MongoDB collection and document_id
eg. a message with routing keyfoo.bar
should be inserted in collection "foo" with document _id "bar" - no assumptions should be made on the type or validity of the routing key, whatever MongoDB accepts is valid
- [Bonus] Websocket clients can subscribe to a collection and will only receive the messages with matching routing keys
- [Bonus] RabbitMQ cleanup (if necessary) before app shutdown
- [Bonus] docker-compose config that launches the dependencies as well as the tornado app
- motor is the recommended asynchronous client library for MongoDB
- you can use rmq_publisher.py for quick testing
- you can assume default auth scheme for RabbitMQ and MongoDB
- a well structured project is expected
- Solution can be provided through a Github repo
- Please do not share this problem definition
- Please delete your repo after evaluation