Example #1
0
        private static void Main(string[] args)
        {
            string address         = ConfigurationManager.AppSettings["ServerAddress"];
            string snapshotaddress = ConfigurationManager.AppSettings["SnapshotServerAddress"];
            string gatewayaddress  = ConfigurationManager.AppSettings["GatewayServerAddress"];

            var snapshotServer = new NetMqSnapshotServer(snapshotaddress, CreateSnapshot);

            snapshotServer.Start();

            var publisher = new NetMqPublisher(address);

            publisher.Start();

            var gateway = new NetMqPushAcceptor(gatewayaddress);

            gateway.Subscribe("q", message =>
            {
                Quote q = BinarySerializer <Quote> .DeSerializeFromByteArray(message);
                QuotesCache[q.InstrumentId] = q;
                publisher.Publish("q", message);
            });
            gateway.Start();

            Console.ReadKey();
        }
Example #2
0
        public void TestPubSub()
        {
            string address = string.Format("tcp://localhost:22244");

            using (var publisher = new NetMqPublisher(address))
                using (var subscriber = new NetMqSubscriber(address))
                    using (var countDown = new CountdownEvent(2))
                    {
                        publisher.Start();
                        subscriber.Start();
                        subscriber.Subscribe("test", m => { if (!countDown.IsSet)
                                                            {
                                                                countDown.Signal();
                                                            }
                                             });

                        Task.Run(() =>
                        {
                            while (!countDown.IsSet)
                            {
                                publisher.Publish("test", new byte[] { 1, 2, 3 });
                                Thread.Sleep(100);
                            }
                        });

                        Assert.IsTrue(countDown.Wait(5000));
                    }
        }
    private void Start()
    {
        GameObject exAccScript = GameObject.Find("AircraftJet");

        accScript       = exAccScript.GetComponent <AccelerometerScript>();
        _netMqPublisher = new NetMqPublisher(HandleMessage);
        _netMqPublisher.Start();
    }
Example #4
0
    private void Start()
    {
        _netMqPublisher = new NetMqPublisher(HandleMessage);
        _netMqPublisher.Start();


        using (var reader = new StreamReader(@"vive_wheel_data_from_1862245.0000_to_1938044.0000_Dataforwardchickenbrian.csv"))
        {
            while (!reader.EndOfStream)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                listA.Add(values[12]);
                //UnityEngine.Debug.Log(values[12]);
                UnityEngine.Debug.Log("start");
            }
        }
    }
Example #5
0
        public bool Start()
        {
            _publisher = new NetMqPublisher(_localAddress);
            _publisher.Start();

            _subscriber = new NetMqSubscriber(_partnerAddress, new DefaultConnectionMonitor(OnConnectionStateChanged));
            if (!_subscriber.StartProducer(_connectTimeout))
            {
                return(false);
            }
            _subscriber.Subscribe(new TopicSubscription <NodeState>
            {
                Topic          = "Cluster",
                MessageHandler = _updateAction,
                Deserializer   = DeserializeState
            });
            _subscriber.StartConsumer();
            return(true);
        }
Example #6
0
        public void Start()
        {
            _processor = new FeedProcessor(OnValidQuote, OnInvalidQuote);
            _processor.Start();

            _snapshotServer = new NetMqSnapshotServer(_snapshotAddress, CreateSnapshot);
            _snapshotServer.Start();

            _publisher = new NetMqPublisher(_publisherAddress);
            _publisher.Start();

            _gateway = new NetMqPushAcceptor(_gatewayAddress);
            _gateway.Subscribe(Constants.QuotesTopicName, message =>
            {
                //TODO: try use protobuff
                var rawQuotes = BinarySerializer<IEnumerable<Quote>>.DeSerializeFromByteArray(message);
                _processor.ProcessQuotes(rawQuotes);
            });
            _gateway.Start();
        }
Example #7
0
        public void Start()
        {
            //Debug.WriteLine(TimerResolution.SetResolution(500));

            _processor = new FeedProcessor(OnValidQuote, OnInvalidQuote);
            _processor.Start();

            _snapshotServer = new NetMqSnapshotServer(_snapshotAddress, CreateSnapshot);
            _snapshotServer.Start();

            _publisher = new NetMqPublisher(_publisherAddress);
            _publisher.Start();

            _gateway = new NetMqPushAcceptor(_gatewayAddress);
            _gateway.Subscribe(Constants.QuotesTopicName, message =>
            {
                //TODO: try use protobuff
                var rawQuotes = BinarySerializer <IEnumerable <Quote> > .DeSerializeFromByteArray(message);
                _processor.ProcessQuotes(rawQuotes);
            });
            _gateway.Start();
        }
        public void TestPubSub()
        {
            string address = string.Format("tcp://localhost:22244");
            using (var publisher = new NetMqPublisher(address))
            using (var subscriber = new NetMqSubscriber(address))
            using (var countDown = new CountdownEvent(2))
            {
                publisher.Start();
                subscriber.Start();
                subscriber.Subscribe("test", m => { if (!countDown.IsSet) countDown.Signal(); });

                Task.Run(() =>
                {
                    while (!countDown.IsSet)
                    {
                        publisher.Publish("test", new byte[] {1, 2, 3});
                        Thread.Sleep(100);
                    }
                });

                Assert.IsTrue(countDown.Wait(5000));
            }
        }
Example #9
0
        private static void Main(string[] args)
        {
            string address = ConfigurationManager.AppSettings["ServerAddress"];
            string snapshotaddress = ConfigurationManager.AppSettings["SnapshotServerAddress"];
            string gatewayaddress = ConfigurationManager.AppSettings["GatewayServerAddress"];

            var snapshotServer = new NetMqSnapshotServer(snapshotaddress, CreateSnapshot);
            snapshotServer.Start();

            var publisher = new NetMqPublisher(address);
            publisher.Start();

            var gateway = new NetMqPushAcceptor(gatewayaddress);
            gateway.Subscribe("q", message =>
            {
                Quote q = BinarySerializer<Quote>.DeSerializeFromByteArray(message);
                QuotesCache[q.InstrumentId] = q;
                publisher.Publish("q", message);
            });
            gateway.Start();

            Console.ReadKey();
        }
Example #10
0
 private void Start()
 {
     _netMqPublisher = new NetMqPublisher(HandleMessage);
     _netMqPublisher.Start();
 }
Example #11
0
 private void Start()
 {
     TIMESCALE       = transform.GetComponent <MyGameManager> ().TIMESCALE;
     _netMqPublisher = new NetMqPublisher(HandleMessage);
     _netMqPublisher.Start();
 }
 private void Start()
 {
     _netMqPublisher = new NetMqPublisher(HandleMessage);
     _netMqPublisher.Start();
     Connected = _netMqPublisher.Connected;
 }