コード例 #1
0
        public void StartStompReceiver(string serverPortTopic)
        {
            string server   = "localhost";
            int    port     = StompConnection.DEFAULT_PORT;
            string topic    = "/topic/Teddi.Sensor";
            string user     = "";
            string password = "";

            ParseServerPortTopic(serverPortTopic, ref server, ref port, ref topic, ref user, ref password);

            // Create STOMP connection
            stompConnection = null;
            try
            {
                stompConnection = new StompConnection(server, port, user, password);
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: Cannot connect to STOMP server: " + e.Message + ".");
            }

            if (stompConnection != null)
            {
                // Subscribe to a topic
                stompConnection.Subscribe(topic);

                // Create threaded listener and add a message handler
                stompListener = new StompListener(stompConnection);
                stompListener.ReceivedMessage += stompListener_ReceivedMessage;
            }
        }
コード例 #2
0
ファイル: Stomp.cs プロジェクト: stuartsoorholtz/openmovement
 public StompListener(StompConnection stompConnection)
 {
     this.stompConnection = stompConnection;
     Start();
 }
コード例 #3
0
        public void StartStompReceiver(string serverPortTopic)
        {
            string server = "localhost";
            int port = StompConnection.DEFAULT_PORT;
            string topic = "/topic/Teddi.Sensor";
            string user = "";
            string password = "";
            ParseServerPortTopic(serverPortTopic, ref server, ref port, ref topic, ref user, ref password);

            // Create STOMP connection
            stompConnection = null;
            try
            {
                stompConnection = new StompConnection(server, port, user, password);
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: Cannot connect to STOMP server: " + e.Message + ".");
            }

            if (stompConnection != null)
            {
                // Subscribe to a topic
                stompConnection.Subscribe(topic);

                // Create threaded listener and add a message handler
                stompListener = new StompListener(stompConnection);
                stompListener.ReceivedMessage += stompListener_ReceivedMessage;
            }
        }
コード例 #4
0
 public StompListener(StompConnection stompConnection)
 {
     this.stompConnection = stompConnection;
     Start();
 }