public static void Put() { Console.WriteLine("===> START of Simple Producer sample for WMQ transport <===\n"); try { SimpleProducer simpleProducer = new SimpleProducer(); if (simpleProducer.EnvironmentIsSet()) { simpleProducer.SendMessage(); } } catch (XMSException ex) { Console.WriteLine("XMSException caught: {0}", ex); if (ex.LinkedException != null) { Console.WriteLine("Stack Trace:\n {0}", ex.LinkedException.StackTrace); } Console.WriteLine("Sample execution FAILED!"); } catch (Exception ex) { Console.WriteLine("Exception caught: {0}", ex); Console.WriteLine("Sample execution FAILED!"); } Console.WriteLine("===> END of Simple Producer sample for WMQ transport <===\n\n"); }
static void Main(string[] args) { String token; if (args.Length < 1) { Console.WriteLine("Say which program you want to run; put, get, pub, sub, request, response"); } else { token = (String)args.GetValue(0); Console.WriteLine(token); switch (token) { case "put": SimpleProducer.Put(); break; case "get": SimpleConsumer.Get(); break; case "sub": SimpleSubscriber.Sub(); break; case "pub": SimplePublisher.Pub(); break; case "request": SimpleRequest.Request(); break; case "response": SimpleResponse.Response(); break; default: Console.WriteLine("Say which program you want to run; put, get, pub, sub, request, response"); break; } } }