Example #1
0
        /// <summary>Create all the message processors with the given queue names at once.
        /// </summary>
        /// <param name="commandQueueNames">Represents the command queue names.</param>
        /// <param name="retryCommandQueueName">Represents the retry command queue name.</param>
        /// <param name="uncommittedEventQueueNames">Represents the uncommitted event queue names.</param>
        /// <param name="committedEventQueueNames">Represents the committed event queue names.</param>
        /// <param name="option">The message processor creation option.</param>
        /// <returns></returns>
        public Configuration CreateAllDefaultProcessors(IEnumerable <string> commandQueueNames, string retryCommandQueueName, IEnumerable <string> uncommittedEventQueueNames, IEnumerable <string> committedEventQueueNames, MessageProcessorOption option = null)
        {
            var messageProcessorOption = option ?? MessageProcessorOption.Default;

            foreach (var queueName in commandQueueNames)
            {
                _commandProcessors.Add(new DefaultCommandProcessor(new DefaultCommandQueue(queueName), messageProcessorOption.CommandExecutorCount));
            }
            _retryCommandProcessor = new DefaultCommandProcessor(new DefaultCommandQueue(retryCommandQueueName), messageProcessorOption.RetryCommandExecutorCount);
            foreach (var queueName in uncommittedEventQueueNames)
            {
                _uncommittedEventProcessors.Add(new DefaultUncommittedEventProcessor(new DefaultUncommittedEventQueue(queueName), messageProcessorOption.UncommittedEventExecutorCount));
            }
            foreach (var queueName in committedEventQueueNames)
            {
                _committedEventProcessors.Add(new DefaultCommittedEventProcessor(new DefaultCommittedEventQueue(queueName), messageProcessorOption.CommittedEventExecutorCount));
            }

            return(this);
        }
Example #2
0
        /// <summary>Config all the message processors with the given queue names at once.
        /// </summary>
        /// <param name="commandQueueNames">Represents the command queue names.</param>
        /// <param name="retryCommandQueueName">Represents the retry command queue name.</param>
        /// <param name="eventQueueNames">Represents the committed event queue names.</param>
        /// <returns></returns>
        public Configuration UseAllDefaultProcessors(IEnumerable<string> commandQueueNames, string retryCommandQueueName, IEnumerable<string> eventQueueNames, MessageProcessorOption option = null)
        {
            var messageProcessorOption = option;
            if (messageProcessorOption == null)
            {
                messageProcessorOption = MessageProcessorOption.Default;
            }

            foreach (var queueName in commandQueueNames)
            {
                _commandProcessors.Add(new DefaultCommandProcessor(new DefaultCommandQueue(queueName), messageProcessorOption.CommandExecutorCount));
            }
            _retryCommandProcessor = new DefaultCommandProcessor(new DefaultCommandQueue(retryCommandQueueName), messageProcessorOption.RetryCommandExecutorCount);
            foreach (var queueName in eventQueueNames)
            {
                _eventProcessors.Add(new DefaultEventProcessor(new DefaultEventQueue(queueName), messageProcessorOption.EventExecutorCount));
            }

            return this;
        }