Worker.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Microsoft.Extensions.Hosting;
  2. using Microsoft.Extensions.Logging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8. using XYY.Service.Standard.Finance.Charging.CustomerOrderFee;
  9. using XYY.Service.Standard.First.JobSubscribe;
  10. using XYY.Service.Standard.Order;
  11. using XYY.TaskTrack.Standard;
  12. namespace XYY.WindowsService.MQ
  13. {
  14. public class Worker : BackgroundService
  15. {
  16. private readonly ILogger<Worker> _logger;
  17. private readonly IMQManager _mQManager;
  18. private readonly IJobSubscribe _jobSubscribe;
  19. private readonly ITrackSupplement _trackSupplement;
  20. private readonly IAddHNJobSubscribe _hNJobSubscribe;
  21. private readonly ISendFirstSubscribe _sendFirstSubscribe;
  22. private readonly ISendFirstNoteSubscribe _sendFirstNoteSubscribe;
  23. private readonly IFinanceQuotationJobSub _financeQuotationJobSub;
  24. private readonly IFeeBaseFileJobSub _feeBaseFileJobSub;
  25. private readonly ICancelOrderJobSubscribe _cancelOrderJobSubscribe;
  26. private readonly IFinanceChargeConsumer _financeChargeConsumer;
  27. private readonly XiKeTrackingSendJobSubscribe XiKeTrackingSendJobSubscribe;
  28. public Worker(ILogger<Worker> logger, IMQManager mQManager,
  29. IJobSubscribe jobSubscribe, IAddHNJobSubscribe hNJobSubscribe,
  30. ISendFirstSubscribe sendFirstSubscribe,
  31. ISendFirstNoteSubscribe sendFirstNoteSubscribe,
  32. IFinanceQuotationJobSub financeQuotationJobSub,
  33. ITrackSupplement trackSupplement, IFeeBaseFileJobSub feeBaseFileJobSub,
  34. ICancelOrderJobSubscribe cancelOrderJobSubscribe,
  35. IFinanceChargeConsumer financeChargeConsumer
  36. , XiKeTrackingSendJobSubscribe xiKeTrackingSendJobSubscribe
  37. )
  38. {
  39. _logger = logger;
  40. _mQManager = mQManager;
  41. _jobSubscribe = jobSubscribe;
  42. _hNJobSubscribe = hNJobSubscribe;
  43. _sendFirstSubscribe = sendFirstSubscribe;
  44. _sendFirstNoteSubscribe = sendFirstNoteSubscribe;
  45. _financeQuotationJobSub = financeQuotationJobSub;
  46. _trackSupplement = trackSupplement;
  47. _feeBaseFileJobSub = feeBaseFileJobSub;
  48. _cancelOrderJobSubscribe = cancelOrderJobSubscribe;
  49. _financeChargeConsumer = financeChargeConsumer;
  50. XiKeTrackingSendJobSubscribe = xiKeTrackingSendJobSubscribe;
  51. }
  52. protected override async Task ExecuteAsync(CancellationToken stoppingToken)
  53. {
  54. await _mQManager.Subscribe(_jobSubscribe);
  55. await _mQManager.Subscribe(_hNJobSubscribe);
  56. await _mQManager.Subscribe(_sendFirstSubscribe);
  57. await _mQManager.Subscribe(_sendFirstNoteSubscribe);
  58. await _mQManager.Subscribe(_financeQuotationJobSub);
  59. await _mQManager.Subscribe(_trackSupplement);
  60. await _mQManager.Subscribe(_feeBaseFileJobSub);
  61. await _mQManager.Subscribe(_cancelOrderJobSubscribe);
  62. await _mQManager.Subscribe(_financeChargeConsumer);
  63. await _mQManager.Subscribe(XiKeTrackingSendJobSubscribe);
  64. }
  65. }
  66. }