예제 #1
0
 internal static DirectoryQueue GetDeadLetterQueueFrom(string queueRootDirectory, string queueName)
 {
     using (DirectoryQueue queue = new DirectoryQueue(queueRootDirectory, queueName))
     {
         queue.CreateIfNotExists();
         return(queue);
     }
 }
예제 #2
0
        internal static DirectoryQueue GetQueueFrom(string queueRootDirectory, string queueName, bool createQueueIfItDoesNotExist)
        {
            DirectoryQueue queue = new DirectoryQueue(queueRootDirectory, queueName);

            if (createQueueIfItDoesNotExist)
            {
                queue.CreateIfNotExists();
            }

            return(queue);
        }
예제 #3
0
 internal static void AddMessageProperties(DirectoryQueue queue, DirectoryQueueMessage cloudMessage, IStorageQueuePropertiesProvider props)
 {
     if (null == props || (null == props.TimeToLive && null == props.InitialVisibilityDelay))
     {
         queue.AddMessage(cloudMessage);
     }
     else
     {
         queue.AddMessage(cloudMessage, props.TimeToLive, props.InitialVisibilityDelay);
     }
 }
예제 #4
0
        internal static void SerializeAndSend(IActorMessage msg, DirectoryQueue queue)
        {
            // Add the message to the azure queue
            DirectoryQueueMessage cloudMessage = BuildMessage(msg);

            AddMessageProperties(queue, cloudMessage, (msg is IStorageQueuePropertiesProvider) ? (msg as IStorageQueuePropertiesProvider): null);

            if (null != msg.Status)
            {
                msg.Status?.SetResult(new QueuedDirectoryMessage(cloudMessage));
            }
        }
예제 #5
0
        internal static void SerializeAndSend(IActorMessage msg, DirectoryQueue queue, string msgString)
        {
            DirectoryQueueMessage cloudMessage = new DirectoryQueueMessage();

            cloudMessage.SetMessageContent(msgString);
            AddMessageProperties(queue, cloudMessage, (msg is IStorageQueuePropertiesProvider) ? (msg as IStorageQueuePropertiesProvider) : null);

            if (null != msg.Status)
            {
                msg.Status?.SetResult(new QueuedDirectoryMessage(cloudMessage));
            }
        }
예제 #6
0
        protected DirectoryQueueBaseOperator(
            ILocalSwitchboard switchboard,
            DirectoryQueue queue,
            DirectoryQueue deadLetterQueue,
            bool recieveMessagesOnly,
            int maxDequeueCount = DefaultDequeueMaxCount,
            TimeSpan?retrieveVisibilityTimeout = null)
        {
            this.recieveMessagesOnly = recieveMessagesOnly;
            if (null != switchboard)
            {
                this.Switchboards.Add(switchboard);
                switchboard.Operator = this;
            }
            this.ID                        = 0;
            this.queue                     = queue;
            this.deadLetterQueue           = deadLetterQueue;
            this.retrieveVisibilityTimeout = retrieveVisibilityTimeout;

            if (null == switchboard && recieveMessagesOnly)
            {
                throw new SwitchBoardNeededWhenRecievingMessagesException();
            }
        }
 public DirectoryDeadletterQueueSubscriptionOperator(ILocalSwitchboard switchBoard, DirectoryQueue queue, DirectoryQueue deadLetterQueue, int maxDequeueCount = DefaultDequeueMaxCount, TimeSpan?retrieveVisibilityTimeout = null)
     : base(switchBoard, queue, deadLetterQueue, true, maxDequeueCount, retrieveVisibilityTimeout)
 {
 }
 public SendMessageToDirectoryQueue(string queueRootDirectory, string queueName, bool createQueueIfItDoesNotExist)
 {
     queue = DirectoryQueueBaseOperator <object> .GetQueueFrom(queueRootDirectory, queueName, createQueueIfItDoesNotExist);
 }
예제 #9
0
 public DirectoryDeadLetterQueuePublishOperator(DirectoryQueue queue, DirectoryQueue deadLetterQueue)
     : base(null, queue, deadLetterQueue, false, DefaultDequeueMaxCount, null)
 {
 }