Exemplo n.º 1
0
        /// <summary>
        /// XML Representation for this object
        /// </summary>
        /// <returns>XML String</returns>

        public String ToXML()
        {
            StringBuilder xml = new StringBuilder();

            xml.Append("<ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2009-02-01/\">");
            if (IsSetReceiveMessageResult())
            {
                ReceiveMessageResult receiveMessageResult = this.ReceiveMessageResult;
                xml.Append("<ReceiveMessageResult>");
                xml.Append(receiveMessageResult.ToXMLFragment());
                xml.Append("</ReceiveMessageResult>");
            }
            if (IsSetResponseMetadata())
            {
                ResponseMetadata responseMetadata = this.ResponseMetadata;
                xml.Append("<ResponseMetadata>");
                xml.Append(responseMetadata.ToXMLFragment());
                xml.Append("</ResponseMetadata>");
            }
            xml.Append("</ReceiveMessageResponse>");
            return(xml.ToString());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the ReceiveMessageResult property
 /// </summary>
 /// <param name="receiveMessageResult">ReceiveMessageResult property</param>
 /// <returns>this instance</returns>
 public ReceiveMessageResponse WithReceiveMessageResult(ReceiveMessageResult receiveMessageResult)
 {
     this.receiveMessageResultField = receiveMessageResult;
     return(this);
 }
 /// <summary>
 /// Sets the ReceiveMessageResult property
 /// </summary>
 /// <param name="receiveMessageResult">ReceiveMessageResult property</param>
 /// <returns>this instance</returns>
 public ReceiveMessageResponse WithReceiveMessageResult(ReceiveMessageResult receiveMessageResult)
 {
     this.receiveMessageResultField = receiveMessageResult;
     return this;
 }
Exemplo n.º 4
0
        public override List<Advertisement> checkMessages()
        {
            List<Advertisement> AdvertisementList = new List<Advertisement>();

            Advertisement newAd = new Advertisement(0,"0","0");

            int currentFetchCounter = 0;

            do
            {
                string fullMessage = string.Empty;
                string receiptHandle;

                string selectedQueue = QueueURLString;

                ReceiveMessageResponse queueReceiveMessageResponse = new ReceiveMessageResponse();

                queueReceiveMessageResponse = objClient.ReceiveMessage(new ReceiveMessageRequest()
                {
                    QueueUrl = selectedQueue,
                    MaxNumberOfMessages = 10,
                    VisibilityTimeout = 5

                });

                ReceiveMessageResult objReceiveMessageResult = new ReceiveMessageResult();

                objReceiveMessageResult = queueReceiveMessageResponse.ReceiveMessageResult;

                List<Amazon.SQS.Model.Message> messagesList = new List<Amazon.SQS.Model.Message>();

                if(objReceiveMessageResult.IsSetMessage())
                     messagesList = objReceiveMessageResult.Message;

                foreach (Amazon.SQS.Model.Message objMessage in messagesList)
                {
                    fullMessage += objMessage.Body;
                    receiptHandle = objMessage.ReceiptHandle;

                    newAd = createAdvertisement(fullMessage);

                    if(!AdvertisementList.Contains(newAd))
                        AdvertisementList.Add(newAd);
                }

                currentFetchCounter++;

            } while (currentFetchCounter<numberOfMsgToFetch);

            return AdvertisementList;
        }