1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using XYY.Service.Standard.RegionService;
- using Agile.Config.Client;
- using XYY.Service.Standard.First.JobSubscribe;
- using XYY.Core.Standard.Data.Infrastructure;
- using XYY.Service.Standard.First.DB;
- using XYY.Data.Standard.Tasks;
- using XYY.Service.Standard.Order;
- using XYY.Service.Standard.Finance.Charging.CustomerOrderFee;
- using XYY.Data.Standard.Charging;
- using XYY.Service.Standard.First.ESB;
- namespace XYY.WindowsService.MQ
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
- public static IHostBuilder CreateHostBuilder(string[] args)
- {
- return Host.CreateDefaultBuilder(args)
- .UseWindowsService()//使用windows服务
- .ConfigureServices((hostContext, services) =>
- {
- services.AddSingleton<IUnitOfWork>(x => new UnitOfWork(ConnectionHelper.BuildDbConnection(
- hostContext.Configuration[DefaultConfig.SqlServiceConnectionKey]), hostContext.Configuration[DefaultConfig.SqlServiceConnectionKey]));
- services.AddSingleton<ITaskTrackDataRepository, TaskTrackDataRepository>();
- services.AddSingleton<IFinance_Charge_LogRepository, Finance_Charge_LogRepository>();
- services.AddXYYService(new ServiceOption
- {
- UseRabbit = true,
- NoService = true,
- OpenChannelApi=true,
- UseTrackingPUSHRedis=true,
- RedisConnection = "r-wz9o30bx758o8jhbrapd.redis.rds.aliyuncs.com"
- }, hostContext.Configuration);
- services.AddSingleton<IFirstDB>(x => new ESFirstDB(hostContext.Configuration[DefaultConfig.ESUrlKey]));
- services.AddSingleton<IFirstDB2>(x => new ESFirstDB2(hostContext.Configuration[DefaultConfig.ESUrlKey]));
- services.AddSingleton<IJobSubscribe, JobSubscribe>();
- services.AddSingleton<ITrackSupplement, TrackSupplement>();
- services.AddSingleton<IAddHNJobSubscribe, AddHNJobSubscribe>();
- services.AddSingleton<ISendFirstSubscribe, SendFirstSubscribe>();
- services.AddSingleton<ISendFirstNoteSubscribe, SendFirstNoteSubscribe>();
- services.AddSingleton<IFinanceQuotationJobSub, FinanceQuotationJobSub>();
- services.AddSingleton<IFeeBaseFileJobSub, FeeBaseFileJobSub>();
- services.AddSingleton<ICancelOrderJobSubscribe, CancelOrderJobSubscribe>();
- services.AddSingleton<IFinanceChargeConsumer, FinanceChargeConsumer>();
- services.AddSingleton<IESBService
- , ESBTrackingService>();
- services.AddSingleton<IWebHook>(x => new QYWXWebHook("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5eb4675a-773a-40a0-9bad-745501122580"));
- services.AddSingleton<ITrackingLogDB>(x => new TrackingLogDB(hostContext.Configuration[DefaultConfig.ESUrlKey]));
- services.AddSingleton<XiKeTrackingSendJobSubscribe>();
- //services.AddTransient<IChargeLogService, ChargeLogService>();
- services.AddHostedService<Worker>();
- }).ConfigureAppConfiguration((context, config) =>
- {
- //使用AddAgileConfig配置一个新的IConfigurationSource
- config.AddAgileConfig();
- });
- }
- }
- }
|