-
Notifications
You must be signed in to change notification settings - Fork 121
/
Copy pathProgram.cs
48 lines (46 loc) · 1.7 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using JT808.Gateway.Abstractions.Enums;
using JT808.Protocol;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
using JT808.Gateway.SimpleServer.Impl;
using JT808.Gateway.SimpleServer.Services;
using JT808.Gateway.Abstractions;
using Microsoft.AspNetCore.Hosting;
using JT808.Gateway.Abstractions.Configurations;
using Microsoft.AspNetCore.Builder;
using JT808.Gateway.Extensions;
namespace JT808.Gateway.SimpleServer
{
class Program
{
static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<ILoggerFactory, LoggerFactory>()
.AddSingleton(typeof(ILogger<>), typeof(Logger<>))
//使用内存队列实现会话通知
.AddSingleton<JT808SessionService>()
.AddSingleton<IJT808SessionProducer, JT808SessionProducer>()
.AddSingleton<IJT808SessionConsumer, JT808SessionConsumer>()
.AddJT808Configure()
.AddGateway(builder.Configuration)
.AddMessageHandler<JT808MessageHandlerImpl>()
.AddMsgLogging<JT808MsgLogging>()
.AddSessionNotice()
.AddTransmit(builder.Configuration)
.AddTcp()
.AddUdp()
.Builder();
builder.Services.AddControllers();
var app = builder.Build();
app.UseRouting();
app.MapControllers();
app.Run();
}
}
}