using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using XYY.Service.Standard.Finance.Charging.CustomerOrderFee; using XYY.Service.Standard.First.JobSubscribe; using XYY.Service.Standard.Order; using XYY.TaskTrack.Standard; namespace XYY.WindowsService.MQ { public class Worker : BackgroundService { private readonly ILogger _logger; private readonly IMQManager _mQManager; private readonly IJobSubscribe _jobSubscribe; private readonly ITrackSupplement _trackSupplement; private readonly IAddHNJobSubscribe _hNJobSubscribe; private readonly ISendFirstSubscribe _sendFirstSubscribe; private readonly ISendFirstNoteSubscribe _sendFirstNoteSubscribe; private readonly IFinanceQuotationJobSub _financeQuotationJobSub; private readonly IFeeBaseFileJobSub _feeBaseFileJobSub; private readonly ICancelOrderJobSubscribe _cancelOrderJobSubscribe; private readonly IFinanceChargeConsumer _financeChargeConsumer; private readonly XiKeTrackingSendJobSubscribe XiKeTrackingSendJobSubscribe; public Worker(ILogger logger, IMQManager mQManager, IJobSubscribe jobSubscribe, IAddHNJobSubscribe hNJobSubscribe, ISendFirstSubscribe sendFirstSubscribe, ISendFirstNoteSubscribe sendFirstNoteSubscribe, IFinanceQuotationJobSub financeQuotationJobSub, ITrackSupplement trackSupplement, IFeeBaseFileJobSub feeBaseFileJobSub, ICancelOrderJobSubscribe cancelOrderJobSubscribe, IFinanceChargeConsumer financeChargeConsumer , XiKeTrackingSendJobSubscribe xiKeTrackingSendJobSubscribe ) { _logger = logger; _mQManager = mQManager; _jobSubscribe = jobSubscribe; _hNJobSubscribe = hNJobSubscribe; _sendFirstSubscribe = sendFirstSubscribe; _sendFirstNoteSubscribe = sendFirstNoteSubscribe; _financeQuotationJobSub = financeQuotationJobSub; _trackSupplement = trackSupplement; _feeBaseFileJobSub = feeBaseFileJobSub; _cancelOrderJobSubscribe = cancelOrderJobSubscribe; _financeChargeConsumer = financeChargeConsumer; XiKeTrackingSendJobSubscribe = xiKeTrackingSendJobSubscribe; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await _mQManager.Subscribe(_jobSubscribe); await _mQManager.Subscribe(_hNJobSubscribe); await _mQManager.Subscribe(_sendFirstSubscribe); await _mQManager.Subscribe(_sendFirstNoteSubscribe); await _mQManager.Subscribe(_financeQuotationJobSub); await _mQManager.Subscribe(_trackSupplement); await _mQManager.Subscribe(_feeBaseFileJobSub); await _mQManager.Subscribe(_cancelOrderJobSubscribe); await _mQManager.Subscribe(_financeChargeConsumer); await _mQManager.Subscribe(XiKeTrackingSendJobSubscribe); } } }