Esempio 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("*");
 }
Esempio n. 2
0
        public void PublishAccountTest()
        {
            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.SubscribeAccountsRMQ("");
            //li
            RabbitMQPublisher.RMQ rmqHelper = new RabbitMQPublisher.RMQ();

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

            K2DataObjects.Account account = JsonConvert.DeserializeObject<K2DataObjects.Account>(accountJSON);

            rmqHelper.Publish("", account);

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