Exemplo n.º 1
0
        public void SetUp()
        {
            _executionMqServer = ContextRegistry.GetContext()["OrderExecutionMqServer"] as OrderExecutionMqServer;
            if (_executionMqServer != null)
            {
                _executionMqServer.Connect();
            }

            //// Initialize Advance Bus
            //_advancedBus = RabbitHutch.CreateBus("host=localhost").Advanced;

            //// Create a admin exchange
            //_adminExchange = _advancedBus.ExchangeDeclare("orderexecution_exchange", ExchangeType.Direct, false, true, false);

            // Create Native Rabbit MQ Bus
            _rabbitMqOrderBus = new ConnectionFactory {
                HostName = "localhost"
            };

            // Create Native Rabbit MQ Connection
            _rabbitMqOrderConnection = _rabbitMqOrderBus.CreateConnection();

            // Open Native Rabbbit MQ Channel
            _rabbitMqOrderChannel = _rabbitMqOrderConnection.CreateModel();
        }
        /// <summary>
        /// Starts required connections
        /// </summary>
        public void StartServer()
        {
            try
            {
                // Configure Logging level
                Logger.SetLoggingLevel();

                if (Logger.IsInfoEnabled)
                {
                    Logger.Info("Starting Order Execution Engine Service", _type.FullName, "StartServer");
                }

                // Connect Order Execution MQ Server
                _mqServer.Connect();
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "StartServer");
            }
        }