/// <summary>
        /// Get all messages from a session less queue
        /// </summary>
        /// <param name="client">QueueClient</param>
        private void GetMessages(QueueClient client)
        {
            try
            {
                BrokeredMessage item = client.Receive(properties.ReceiveTimeout);

                while (true)
                {
                    if (item == null)
                    {
                        break;
                    }

                    if (SubmitMessage(item) == false)
                    {
                        client.Abort();
                        break;
                    }

                    //allow setting timeout
                    item = client.Receive(properties.ReceiveTimeout);
                }
            }
            catch (Exception)
            {
                //probably lock
            }
        }
        public async Task <Boolean> ReadFromQueueAndIndexAsync(AzureSearchManager searchMan)
        {
            if (searchMan == null)
            {
                throw new ArgumentNullException("searchMan");
            }

            try
            {
                var msg = _qClient.Receive();

                if (msg == null)
                {
                    return(false);
                }

                await searchMan.IndexDocumentAsync(msg.GetBody <string>());

                _qClient.Complete(msg.LockToken);

                return(true);
            }
            catch (Exception ex)
            {
                _qClient.Abort();

                throw ex;
            }
        }
 /// <summary>
 /// Closes the connection to the ServiceFabric Service
 /// </summary>
 public void AbortClient()
 {
     _sendClient?.Abort();
 }