public EmsWorkItem
     (
     decimal id,
     int externalEntityId,
     WorkItemState workItemState,
     SubmissionPriority submissionPriority,
     byte[] messageBody,
     bool assigned,
     bool isRetry,
     string ownerName,
     ContextIdentifier contextIdentifier,
     EmsReaderQueue queue,
     Message message
     )
     : base
         (
         id,
         externalEntityId,
         workItemState,
         submissionPriority,
         messageBody,
         assigned,
         isRetry,
         ownerName,
         contextIdentifier
         )
 {
     this.queue = queue;
     this.message = message;
 }
 public ResponseWorkItem
     (
     long id,
     int externalEntityId,
     WorkItemState workItemState,
     SubmissionPriority submissionPriority,
     byte[] messageBody,
     bool assigned,
     bool isRetry,
     string ownerName,
     ContextIdentifier contextIdentifier
     )
     : base
         (
         id,
         externalEntityId,
         workItemState,
         submissionPriority,
         messageBody,
         assigned,
         isRetry,
         ownerName,
         contextIdentifier
         )
 {
 }
        public RetrievedItemsCleanerManager
            (
            WorkItemSlotCollection retrievedItems,
            bool retrievalQueueRecoverable,
            ContextIdentifier contextIdentifier,
            int retrievedItemsCleanerInterval,
            string name,
            string description,
            int cleanersCount,
            int cleanerRegularStopTimeout
            )
            : base
                (
                name,
                description
                )
        {
            _retrievedItems = retrievedItems;
            _retrievalQueueRecoverable = retrievalQueueRecoverable;
            _contextIdentifier = contextIdentifier;
            _retrievedItemsCleanerInterval = retrievedItemsCleanerInterval;

            this.cleanersCount = cleanersCount;
            this.cleanerRegularStopTimeout = cleanerRegularStopTimeout;
        }
 public FailoverManagerException(
     object eventId,
     ContextIdentifier contextIdentifier
     )
     : this(null,
         eventId,
         contextIdentifier,
         null)
 {
 }
 public CommandValidationException
     (
     Enum eventId,
     ContextIdentifier contextIdentifier,
     string details,
     Exception innerException
     )
     : base(eventId, contextIdentifier, details, innerException)
 {
 }
 public FailoverManagerException(
     string details,
     object eventId,
     ContextIdentifier contextIdentifier
     )
     : this(details,
         eventId,
         contextIdentifier,
         null)
 {
 }
 public FailoverManagerException(
     string details,
     object eventId,
     ContextIdentifier contextIdentifier,
     Exception innerException
     )
     : base(Convert.ToInt32(eventId),
         contextIdentifier,
         details,
         innerException)
 {
 }
 public TraceEvent(
     object eventId,
     TraceEventType type,
     string message,
     ContextIdentifier contextIdentifier
     )
     : this(eventId,
         type,
         message,
         contextIdentifier,
         null)
 {
 }
        public RetrievedItemsCleaner
            (WorkItemSlotCollection retrievedItems, ContextIdentifier contextIdentifier, int retrievedItemsCleanerInterval, int cleanerRegularStopTimeout, string name, string description)
            : base
                (
                name,
                description
                )
        {
            _retrievedItems = retrievedItems;
            _contextIdentifier = contextIdentifier;
            _retrievedItemsCleanerInterval = retrievedItemsCleanerInterval;

            this.cleanerRegularStopTimeout = cleanerRegularStopTimeout;
        }
 public TraceEvent(
     object eventId,
     string message,
     ContextIdentifier contextIdentifier,
     object context
     )
     : this(eventId,
         TraceEventType.Verbose,
         message,
         contextIdentifier,
         context)
 {
 }
        public override void Start()
        {
            contextIdentifier = new ContextIdentifier();
            //activeProcessesCounter	= 0;
            cleanerStopEvent = new AutoResetEvent(false);

            producers =
                new List<IProcess>();

            uint producerCount = 0;

            #region Create producers

            foreach (ProcessorConfiguration processorConfiguration in ProducersDefinition)
            {
                producerCount = processorConfiguration.Count;

                for (int i = 0; i < producerCount; i++)
                {
                    Producer producer =
                        ProcessorFactory.CreateProducer
                            (
                            processorConfiguration.Name
                            );
                    
                    producer.SetParameters(new ProcessorConfiguration
                                               {
                                                   Count = processorConfiguration.Count,
                                                   Description = processorConfiguration.Description,
                                                   Enabled = processorConfiguration.Enabled,
                                                   // Change name to reflect the index of the 
                                                   // current producer
                                                   Name = processorConfiguration.Name + "_" + i,
                                                   Priority = processorConfiguration.Priority
                                               });

                    producers.Add(producer);
                }
            }

            #endregion Create producers

            Log.TraceData(Log.Source,TraceEventType.Verbose,
                                 ProducerManagerMessage.StartingProducing,
                                 new ContextualLogEntry
                                     {
                                         Message =
                                             string.Format
                                             (
                                             "'{0}': Starting Producing with {1} primary and {2} secondary producers.",
                                             Name,
                                             producerCount, 0
                                             ),
                                         ContextIdentifier = contextIdentifier
                                     });

            foreach (IProcess producer in producers)
            {
                producer.Start();
            }

            SetExecutionState(ProcessExecutionState.Running);
        }
        public override void Start()
        {
            _contextIdentifier = new ContextIdentifier();

            Log.TraceData(Log.Source,TraceEventType.Start,
                                 ConsumerMessage.QueueWorkItemsConsumerStartRequested,
                                 new ContextualLogEntry
                                     {
                                         Message =
                                             string.Format
                                             (
                                             "{0} process is starting.",
                                             Name
                                             ),
                                         ContextIdentifier = ContextIdentifier
                                     });

            base.Start();
        }
        public TraceEvent(
            object eventId,
            TraceEventType type,
            ApplicationLifeCycleType lifeCycleType,
            EventCategory category,
            string message,
            ContextIdentifier contextIdentifier,
            object context
            )
            : this()
        {
            try
            {
                EventIdText = eventId.ToString();
                EventId = Convert.ToInt32(eventId);
            }
            catch (Exception e)
            {
                EventId = 0;
                // TODO: Add loggin of that as a warning! (SD)
            }
            _type = type;
            _lifeCycleType = lifeCycleType;

            // This conversion is done here in order to de-couple all
            // possible enumeration types that can be encountered here.
            // This is done according to the fact that other app domains
            // would need to know them then, and it is not the point.
            Message = (string.IsNullOrEmpty(message)) ? eventId.ToString() : message;

            ContextIdentifier = contextIdentifier ?? new ContextIdentifier();
            _category = category;
            Context = context;
        }
        protected WorkItem
            (
            decimal id,
            int externalEntityId,
            WorkItemState workItemState,
            SubmissionPriority submissionPriority,
            byte[] messageBody,
            bool assigned,
            bool isRetry,
            string ownerName,
            ContextIdentifier contextIdentifier
            )
        {
            Id = id;
            ExternalEntityId = externalEntityId;
            _workItemState = workItemState;
            _submissionPriority = submissionPriority;
            _messageBody = messageBody;
            Assigned = assigned;
            IsRetry = isRetry;
            OwnerName = ownerName;
            _contextIdentifier = contextIdentifier;
//			_processCode = processCode;
//			_assignmentToken = assignmentToken;
        }
 public TraceEvent(
     object eventId,
     TraceEventType type,
     string message,
     ContextIdentifier contextIdentifier,
     object context
     )
     : this(eventId,
         type,
         ApplicationLifeCycleType.Runtime,
         message,
         contextIdentifier,
         context)
 {
 }
 public TraceEvent(
     object eventId,
     TraceEventType type,
     ApplicationLifeCycleType lifeCycleType,
     string message,
     ContextIdentifier contextIdentifier,
     object context
     )
     : this(eventId,
         type,
         lifeCycleType,
         EventCategory.None,
         message,
         contextIdentifier,
         context)
 {
 }
 public BaseException
     (
     int eventId,
     ContextIdentifier contextIdentifier,
     string details,
     Exception innerException
     )
     : base(details, innerException)
 {
     LoggingEventID = eventId;
     _contextIdentifier = contextIdentifier;
 }
 public BaseException
     (
     Enum eventId,
     ContextIdentifier contextIdentifier,
     string details,
     Exception innerException
     )
     : base(details, innerException)
 {
     LoggingEventID = Convert.ToInt32(eventId);
     _contextIdentifier = contextIdentifier;
 }
        public override void Start()
        {
            contextIdentifier = new ContextIdentifier();

            Log.TraceData(Log.Source,TraceEventType.Start,
                                 ConsumerManagerMessage.QueueWorkItemsConsumerManagerStartRequested,
                                 new ContextualLogEntry
                                     {
                                         Message =
                                             string.Format
                                             (
                                             "{0} process is starting.",
                                             Name
                                             ),
                                         ContextIdentifier = ContextIdentifier
                                     });

            CreateConsumers();

            Log.TraceData(Log.Source,TraceEventType.Start,
                                 ConsumerManagerMessage.QueueWorkItemsConsumerManagerStartRequested,
                                 new ContextualLogEntry
                                     {
                                         Message =
                                             string.Format
                                             (
                                             "'{0}': Starting Consuming.",
                                             Name
                                             ),
                                         ContextIdentifier = contextIdentifier
                                     });

            foreach (IProcess consumer in Consumers)
            {
                consumer.Stopped += Consumer_Stopped;
                consumer.Start();
            }
            // If child object setup the collector StartInternal it
            // TODO: reiterate on that, ad hoc fix for response service!! (SD)
            if (TimeOutSubmissionsCollector != null)
            {
                TimeOutSubmissionsCollector.Start();
            }

            SetExecutionState(ProcessExecutionState.Running);

            Log.TraceData(Log.Source,TraceEventType.Start,
                                 ConsumerManagerMessage.QueueWorkItemsConsumerManagerStartRequested,
                                 new ContextualLogEntry
                                     {
                                         Message =
                                             string.Format
                                             (
                                             "{0} process started.",
                                             Name
                                             ),
                                         ContextIdentifier = ContextIdentifier
                                     });
        }