Ejemplo n.º 1
0
 public void Start()
 {
     listner = new RabbitMQPublisher.RMQListner();
     RabbitMQPublisher.RMQFactory.Instance().HostName = "10.1.11.14";
     listner.SubscribeInfo();
     listner.OnRMQMessage += OnRMQMessage;
     listner.SubscribeProductsRMQ("");
     listner.SubscribeAccountsRMQ("");
     listner.SubscribeProductsRMQ("");
     listner.SubscribeTSBarsRMQ("*");
 }
Ejemplo n.º 2
0
        public void PublishProductTest()
        {
            RabbitMQPublisher.RMQFactory.Instance().HostName = hostName;
            var channel = RabbitMQPublisher.RMQFactory.Instance().GetRMQChannel(KaiTrade.Interfaces.MQExchanges.DEFAULT);
            Assert.IsNotNull(channel);

            listner = new RabbitMQPublisher.RMQListner();
            listner.SubscribeInfo();
            listner.OnRMQMessage += OnRMQMessage;
            listner.SubscribeProductsRMQ("");
            //li
            RabbitMQPublisher.RMQ rmqHelper = new RabbitMQPublisher.RMQ();

            // Example #1
            // Read the file as one string.
            string productJSON = System.IO.File.ReadAllText(@"testdata\productJSON.txt");

            K2DataObjects.Product product = JsonConvert.DeserializeObject<K2DataObjects.Product>(productJSON);

            rmqHelper.Publish("", product);

            System.Threading.Thread.Sleep(10000);
        }