예제 #1
0
 public void SendAndSyncReceive()
 {
     using (StompConnection stomp = new StompConnection("localhost", 61626))
     {
         stomp.Subscribe("/queue/test");
         stomp.Send("/queue/test", "Hello world!");
         Message message = stomp.WaitForMessage();
         Assert.AreEqual("Hello world!", message.Body);
     }
 }
예제 #2
0
        private void Connection_StateChanged(object sender, StompConnectionStateChangedEventArgs e)
        {
            switch (connection.State)
            {
            case StompConnectionState.Connected:
                var connect = new Connect(
                    host: settings.BrokerUrl,
                    login: settings.Username,
                    passcode: settings.Password,
                    domain: settings.Domain);
                connection.Send(connect);
                break;

            case StompConnectionState.Connecting:
                ChangeConnectionStatus(ConnectionStatus.Connecting);
                break;

            case StompConnectionState.Disconnected:
                ChangeConnectionStatus(ConnectionStatus.Disconnected);
                break;
            }
        }