ShoutLib.Shouter.Shout C# (CSharp) Method

Shout() public method

Waits for a shout request message to arrive in the Pub/Sub subscription. Converts the text to uppercase and posts the results back to the website.
Nothing more than a wrapper around ShoutOrThrow() to catch unexpected exceptions.
public Shout ( System cancellationToken ) : int
cancellationToken System
return int
        public int Shout(System.Threading.CancellationToken cancellationToken)
        {
            try
            {
                return ShoutOrThrow(cancellationToken);
            }
            catch (Exception e)
            {
                // Something went really wrong.  Don't attempt to touch PublishStatus because
                // that could be what broke.
                WriteLog(e.Message + "\n" + e.StackTrace, TraceEventType.Error);
            }
            return -1;
        }

Usage Example

 private static void Main(string[] args)
 {
     using (var logWriter = CreateStandardOutputLogWriter())
     {
         var shouter = new Shouter(logWriter);
         while (true)
         {
             shouter.Shout(new System.Threading.CancellationToken());
         }
     }
 }
All Usage Examples Of ShoutLib.Shouter::Shout