/// <summary>
        /// Initializes a new instance of the <see cref="TransactionJobProcessor"/> class.
        /// </summary>
        /// <param name="agentId">
        /// The agent id.
        /// </param>
        /// <param name="jobsQueue">
        /// The jobs queue.
        /// </param>
        public TransactionJobProcessor(string agentId, PartnerTransactionsQueue jobsQueue)
        {
            this._agentId   = agentId;
            this._jobsQueue = jobsQueue;
            Uri dealsServerBaseAddress = new Uri(CloudConfigurationManager.GetSetting(DealsServerAddressSetting));

            _dealsClient = new DealsClient(dealsServerBaseAddress, ClientName);
            InitializePartnerToReporter();
        }
예제 #2
0
        /// <summary>
        /// Bootstraps the job agents
        /// </summary>
        /// <param name="idPrefix">
        /// The agent id Prefix.
        /// </param>
        /// <returns>
        /// List of instantiaged job processors
        /// </returns>
        public IEnumerable <TransactionJobProcessor> Bootstrap(string idPrefix)
        {
            int jobProcessorCount = int.Parse(CloudConfigurationManager.GetSetting(JobsProcessorCountSetting));

            Log.Verbose("Reporting Manager. Bootstrap Start - agents number = {0}", jobProcessorCount);

            string storageSetting     = CloudConfigurationManager.GetSetting(StorageSetting);
            string emailJobsQueueName = CloudConfigurationManager.GetSetting(TransactionJobsQueueNameSetting);

            //Initialize the transaction jobs queue
            PartnerTransactionsQueue       partnerTransactionsQueue = new PartnerTransactionsQueue(storageSetting, emailJobsQueueName);
            List <TransactionJobProcessor> agents = new List <TransactionJobProcessor>();

            for (int i = 0; i < jobProcessorCount; i++)
            {
                TransactionJobProcessor transactionJobProcessor = new TransactionJobProcessor(idPrefix + "_" + i, partnerTransactionsQueue);
                agents.Add(transactionJobProcessor);
            }

            Log.Verbose("Reporting Manager. Bootstrap Completed - agents number = {0}", jobProcessorCount);

            return(agents);
        }