Ejemplo n.º 1
0
        // GET: Publish
        public ActionResult Subscribes()
        {
            var cfp = new ContextFactoryProperties()
            {
                SolClientLogLevel = SolLogLevel.Warning
            };

            cfp.LogToConsoleError();

            ContextFactory.Instance.Init(cfp);

            try
            {
                // Context must be created first
                using (IContext context = ContextFactory.Instance.CreateContext(new ContextProperties(), null))
                {
                    // Create the application
                    TopicSubscriber topicSubscriber = new TopicSubscriber(_vpnName, _userName, _password);

                    // Run the application within the context and against the host
                    topicSubscriber.Run(context, _host);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception thrown: {0}", ex.Message);
            }
            finally
            {
                // Dispose Solace Systems Messaging API
                ContextFactory.Instance.Cleanup();
            }

            return(View());
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     TopicSubscriber.Run(args);
 }