Beispiel #1
0
        /// <summary>
        ///     Marks a task as finished
        /// </summary>
        /// <returns>The task to mark completed</returns>
        public async Task <Guid> AcknowledgeAsync(WorkTask task)
        {
            var request = new AcknowledgeRequest {
                Id = task.Id.ToString()
            };
            var wrapper = new RequestWrapper {
                Acknowledge = request
            };

            await ExecuteRequest(wrapper, ResponseWrapper.MessageOneofCase.Acknowledge);

            return(task.Id);
        }
Beispiel #2
0
        /// <summary>
        ///     Pops a single message of the queue.
        ///     When the message has been handled successfully, Acknowledge should be called
        /// </summary>
        /// <param name="availableCapabilities">The capabilities this server has available</param>
        /// <param name="waitForMessages">If the method should wait for a response to be available before returning</param>
        /// <returns>A task that should be worked on</returns>
        public async Task <WorkTask> PopAsync(List <string> availableCapabilities, bool waitForMessages)
        {
            var request = new PopRequest {
                WaitForMessage = waitForMessages
            };

            request.AvailableCapabilities.AddRange(availableCapabilities);
            var wrapper = new RequestWrapper {
                Pop = request
            };

            var responseWrapper = await ExecuteRequest(wrapper, ResponseWrapper.MessageOneofCase.Pop);

            var response = responseWrapper.Pop;
            var workTask = new WorkTask(Guid.Parse(response.Id), response.Message.ToByteArray(), this);

            return(workTask);
        }
Beispiel #3
0
 /// <summary>
 ///     Marks a task as finished
 /// </summary>
 /// <returns>The task to mark completed</returns>
 public Guid Acknowledge(WorkTask task)
 {
     return(ExecuteAsyncSync(AcknowledgeAsync(task)));
 }