Skip to content

Instantly share code, notes, and snippets.

@eguven
Last active May 31, 2018 12:51
Show Gist options
  • Save eguven/63b05f4c4c4cba459740553e22404d93 to your computer and use it in GitHub Desktop.
Save eguven/63b05f4c4c4cba459740553e22404d93 to your computer and use it in GitHub Desktop.
Problem description for python developer candidate

Problem [python developer]

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 key foo.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

  • [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

Notes

  • 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

Notice

  • Solution can be provided through a Github repo
  • Please do not share this problem definition
  • Please delete your repo after evaluation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment