private int AwaitNotification(int timeout) { int resultCode = 0; string errorMessage = string.Empty; FileLogger.Log("Start awaiting notification ..."); try { IMessageConsumer consumer = Services.GetService <IMessageConsumer>(); resultCode = consumer.AwaitNotification(timeout, out errorMessage); } catch (Exception error) { errorMessage += (string.IsNullOrEmpty(errorMessage) ? string.Empty : Environment.NewLine) + ExceptionHelper.GetErrorText(error); } if (!string.IsNullOrEmpty(errorMessage)) { FileLogger.Log(errorMessage); } if (resultCode == 0) { FileLogger.Log("Notification received successfully."); } else if (resultCode == 1) { FileLogger.Log("Notifications are not supported."); } else if (resultCode == 2) { FileLogger.Log("No notification received."); } return(resultCode); }