コード例 #1
0
ファイル: BrokerClient.cs プロジェクト: melo/sapo-broker
        private void InitiateSocketToReceive(Notify notify)
        {
            string action = "";
            if (notify.DestinationType == DestinationType.QUEUE)
            {
                action = "http://services.sapo.pt/broker/listen";
            }
            else if ((notify.DestinationType == DestinationType.TOPIC) ||
                (notify.DestinationType == DestinationType.TOPIC_AS_QUEUE))
            {
                action = "http://services.sapo.pt/broker/subscribe";
            }
            else
            {
                throw new ArgumentException("Mal-formed NotificationRequest object");
            }

            //CreateSocket();

            SoapEnvelope soap = BuildSoapEnvelope(action);
            soap.Body.Notify = notify;
            _notify = notify;
            _skClient.SendMessageAsync(soap, true);
            //_skClient.SetListener(listener);
        }
コード例 #2
0
ファイル: BrokerClient.cs プロジェクト: melo/sapo-broker
 public void AddAsyncConsumer(Notify notify, IListener listener)
 {
     if ((notify != null) && (!IsBlank(notify.DestinationName)))
     {
         if (!_skClient.HasListeners())
         {
             InitiateSocketToReceive(notify);
         }
         _skClient.Listeners += new BrokerHandler(listener.OnMessage);
     }
     else
     {
         throw new ArgumentException("Mal-formed NotificationRequest object");
     }
 }