diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj
new file mode 100644
index 0000000..11a9963
--- /dev/null
+++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj
@@ -0,0 +1,30 @@
+
+
+
+
+ netstandard2.1
+ 8.0
+ Copyright 2019.
+ SmallChi(Koike)
+ https://github.com/SmallChi/JT808Gateway
+ https://github.com/SmallChi/JT808Gateway
+ https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE
+ https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE
+ false
+ $(JT808GatewayPackageVersion)
+ false
+ LICENSE
+ true
+ JT808.Gateway.MsgIdHandler
+ JT808.Gateway.MsgIdHandler
+ 基于JT808消息业务处理程序服务
+ 基于JT808消息业务处理程序服务
+ LICENSE
+
+
+
+
+
+
+
+
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs
new file mode 100644
index 0000000..4a711e8
--- /dev/null
+++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs
@@ -0,0 +1,19 @@
+using JT808.Gateway.Abstractions;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT808.Gateway.MsgIdHandler
+{
+ public static class JT808MsgIdHandlerExtensions
+ {
+ public static IJT808ClientBuilder AddMsgIdHandler(this IJT808ClientBuilder jT808ClientBuilder)
+ where TJT808MsgIdHandler: IJT808MsgIdHandler
+ {
+ jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808MsgIdHandler),typeof(TJT808MsgIdHandler));
+ jT808ClientBuilder.JT808Builder.Services.AddHostedService();
+ return jT808ClientBuilder;
+ }
+ }
+}
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs
new file mode 100644
index 0000000..db2a100
--- /dev/null
+++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs
@@ -0,0 +1,34 @@
+using System.Threading.Tasks;
+using Microsoft.Extensions.Hosting;
+using System.Threading;
+using JT808.Gateway.Abstractions;
+
+namespace JT808.Gateway.MsgIdHandler
+{
+ public class JT808MsgIdHandlerHostedService : IHostedService
+ {
+ private readonly IJT808MsgConsumer jT808MsgConsumer;
+
+ private readonly IJT808MsgIdHandler jT808MsgIdHandler;
+ public JT808MsgIdHandlerHostedService(
+ IJT808MsgIdHandler jT808MsgIdHandler,
+ IJT808MsgConsumer jT808MsgConsumer)
+ {
+ this.jT808MsgIdHandler = jT808MsgIdHandler;
+ this.jT808MsgConsumer = jT808MsgConsumer;
+ }
+
+ public Task StartAsync(CancellationToken cancellationToken)
+ {
+ jT808MsgConsumer.Subscribe();
+ jT808MsgConsumer.OnMessage(jT808MsgIdHandler.Processor);
+ return Task.CompletedTask;
+ }
+
+ public Task StopAsync(CancellationToken cancellationToken)
+ {
+ jT808MsgConsumer.Unsubscribe();
+ return Task.CompletedTask;
+ }
+ }
+}