51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
|
|
using JiShe.CollectBus.Core.Plugins;
|
|||
|
|
using JiShe.CollectBus.Core.Services;
|
|||
|
|
using JiShe.CollectBus.EntityFrameworkCore;
|
|||
|
|
using JiShe.CollectBus.RabbitMQ;
|
|||
|
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
using TouchSocket.Core;
|
|||
|
|
using TouchSocket.Sockets;
|
|||
|
|
using Volo.Abp;
|
|||
|
|
using Volo.Abp.Modularity;
|
|||
|
|
|
|||
|
|
namespace JiShe.CollectBus.Core
|
|||
|
|
{
|
|||
|
|
[DependsOn(typeof(JiSheCollectBusEntityFrameworkCoreModule),
|
|||
|
|
typeof(JiSheCollectBusRabbitMqModule))]
|
|||
|
|
public class JiSheCollectBusCoreModule : AbpModule
|
|||
|
|
{
|
|||
|
|
public override async void ConfigureServices(ServiceConfigurationContext context)
|
|||
|
|
{
|
|||
|
|
var configuration = context.Services.GetConfiguration();
|
|||
|
|
context.Services.AddTcpService(config =>
|
|||
|
|
{
|
|||
|
|
config.SetListenIPHosts(int.Parse(configuration["TCP:ClientPort"] ?? "10500"))
|
|||
|
|
//.SetTcpDataHandlingAdapter(()=>new StandardFixedHeaderDataHandlingAdapter())
|
|||
|
|
.ConfigurePlugins(a =>
|
|||
|
|
{
|
|||
|
|
a.Add<TcpClosePlugin>();
|
|||
|
|
a.Add<TcpServicePlugin>();
|
|||
|
|
a.Add<BusService>();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
context.Services.AddUdpSession(config =>
|
|||
|
|
{
|
|||
|
|
config.SetBindIPHost(int.Parse(configuration["UDP:ClientPort"] ?? "10500"))
|
|||
|
|
.ConfigurePlugins(a =>
|
|||
|
|
{
|
|||
|
|
a.Add<UdpServicePlugin>();
|
|||
|
|
a.Add<BusService>();
|
|||
|
|
})
|
|||
|
|
.UseBroadcast()
|
|||
|
|
.SetUdpDataHandlingAdapter(() => new NormalUdpDataHandlingAdapter());
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|