drupal_set_message() has been deprecated as of Drupal 8.5. This update updates this code to the newer way of doing things.
I have updated the controller to extend the controller base class, so that I can show the message that was being set using the Drupal set message function, using Drupal 8's new messenger class. The messenger functionality has been included using dependency injection.