Beispiel #1
0
        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);
        }
Beispiel #2
0
 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");
     }
 }