Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // Get rid of compiler warnings by using the GenericResolver related variables.
            m_SbMessage        = new TestMessage();
            m_InProcessFeedMsg = new InProcessFeedMsg();

            Console.Title = m_ThisName;
            Console.WriteLine("{0}.Main(): Entered. Awaiting your input to start the", m_ThisName);
            Console.WriteLine("  QueuedServicsBusHost for the Service Bus queue '{0}'\n  via WCF NetMessagingBinding.",
                              ConstantsNEnums.IngestionQueueName);
            ConsoleNTraceHelpers.PauseTillUserPressesEnter();
            QueuedServiceBusHost queuedHost = null;

            try
            {
                Uri sbBaseAddr = new Uri("sb://AzExploreSbNS.servicebus.windows.net/");
                queuedHost = new QueuedServiceBusHost(typeof(DataFeedManager), false, sbBaseAddr);
                queuedHost.Open();
                Console.WriteLine("{0}.Main():  QueuedServiceBusHost opened OK.  Working.....", m_ThisName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}.Main():  host.Open() Threw exception!\n     {1}", m_ThisName, ex);
            }

            Console.WriteLine("\n{0}.Main():  Press ENTER to EXIT.", m_ThisName);
            Console.ReadLine();
            CloseOrAbortHosts(queuedHost);
            Console.WriteLine("\n{0}.Main(): Exiting......", m_ThisName);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Title = m_ThisName;
            Console.WriteLine("{0}.Main(): Entered. Awaiting your input to start the", m_ThisName);
            Console.WriteLine("  QueuedServicsBusHost for the Service Bus queue '{0}'\n  via WCF NetMessagingBinding.",
                              ConstsNEnums.IngestionQueueName);
            ConsoleNTraceHelpers.PauseTillUserPressesEnter();
            QueuedServiceBusHost host = null;

            try
            {
                host = new QueuedServiceBusHost(typeof(DataFeedsManager.DataFeedsManager));
                host.Open();
                Console.WriteLine("{0}.Main():  QueuedServiceBusHost opened OK.  Working.....", m_ThisName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}.Main():  host.Open() Threw exception!\n     {1}", m_ThisName, ex.ToString());
            }

            Console.WriteLine("\n{0}.Main():  Press ENTER to EXIT.", m_ThisName);
            Console.ReadLine();
            if (host != null)
            {
                host.Close();
            }
            Console.WriteLine("\n{0}.Main(): Exiting......", m_ThisName);
        }
Exemplo n.º 3
0
 private static void CloseOrAbortHosts(QueuedServiceBusHost queuedHost)
 {
     if (queuedHost != null)
     {
         if (queuedHost.State != CommunicationState.Faulted)
         {
             queuedHost.Close();
         }
         else
         {
             queuedHost.Abort();
         }
     }
 }
        private bool OpenServiceHost()
        {
            bool serviceHostOk = false;

            try
            {
                m_QueuedServiceBusHost = new QueuedServiceBusHost(typeof(DataFeedManager));
                m_QueuedServiceBusHost.Open();
                serviceHostOk = true;
                Trace.TraceInformation("\n**" + m_ThisName + ".OpenServiceHost():  QueuedServiceBusHost opened Ok.");
            }
            catch (Exception ex)
            {
                Trace.TraceError("\n**" + m_ThisName + ".OpenServiceHost():  host.Open() Threw exception!\n" + ex);
                m_QueuedServiceBusHost.Abort();
            }
            return(serviceHostOk);
        }