Exemplo n.º 1
0
        public void UpdateTimeout(WorkflowMessage message, int timeout)
        {
            var cloudMessage      = new CloudQueueMessage(message.Id, message.ReceiptId);
            var visibilityTimeout = TimeSpan.FromSeconds(timeout);

            _queue.UpdateMessageAsync(cloudMessage, visibilityTimeout, MessageUpdateFields.Visibility).Wait();
        }
Exemplo n.º 2
0
        public WorkflowMessage Dequeue()
        {
            if (_queue.TryDequeue(out string content))
            {
                return(WorkflowMessage.CreateFrom(this, GetId(), content, null));
            }

            return(null);
        }
Exemplo n.º 3
0
        public WorkflowMessage Dequeue()
        {
            TimeSpan visibility = TimeSpan.FromSeconds(5);

            var queueMessage = _queue.GetMessageAsync(visibility, null, null).Result;

            if (queueMessage == null)
            {
                return(null);
            }

            return(WorkflowMessage.CreateFrom(this, queueMessage.Id, queueMessage.AsString, queueMessage.PopReceipt));
        }
Exemplo n.º 4
0
        protected virtual void ProcessMessage(WorkflowMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            int timeout = GetModuleTimeout(message.Module);

            message.UpdateTimeout(timeout);

            RunLocal(message.Module, message.Method, message.Parameter);

            message.Complete();
        }
Exemplo n.º 5
0
 public void Complete(WorkflowMessage message)
 {
     // ignore
 }
Exemplo n.º 6
0
 public void UpdateTimeout(WorkflowMessage message, int timeout)
 {
     // ignore
 }
Exemplo n.º 7
0
 public void Enqueue(WorkflowMessage message)
 {
     _queue.Enqueue(message.GetContent());
 }
Exemplo n.º 8
0
 public void Complete(WorkflowMessage message)
 {
     _queue.DeleteMessageAsync(message.Id, message.ReceiptId).Wait();
 }
Exemplo n.º 9
0
        public void Enqueue(WorkflowMessage message)
        {
            var queueMessage = new CloudQueueMessage(message.GetContent());

            _queue.AddMessageAsync(queueMessage).Wait();
        }
Exemplo n.º 10
0
        public void Start(string module, string method, object parameter)
        {
            var message = WorkflowMessage.CreateCall(module, method, parameter);

            _queue.Enqueue(message);
        }