Unable to set drupal_set_message() after logout redirect I want to show a message via drupal_set_message() after logout and redirects to page.

Code:

/*
 * Implements hook_user_logout().
 */
function example_user_logout($account){
  $login_message = 'You have been redirected';
  drupal_set_message(t($login_message));
  $login_redirect = '/mypage';
  example_redirect($login_redirect);
}

/**
 * Redirect path for logout.
 */
function example_redirect($path) {
  $response = new RedirectResponse($path);
  $response-&gt;send();
  exit;
}


Tried commenting exit also, but still no luck.
Any help would be appreciable.
drupal_set_message() sets the message in $_SESSION. By logging out, you destroy the current session and thus wipe the message you just set.