执 行节点开发
.NetCore
- 安装nuget依赖
dotnet add package OpenTask.Core
- 注册Handler
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((ctx, services) =>
{
_ = services.AddOpenTaskWorker(ctx.Configuration.GetSection("OpenTaskWorker"), options =>
{
options.AddHandler<DemoJobHandler>();
options.AddHandler<JobHandler>();
});
})
.Build();
host.Run();
- 配置文件
{
"OpenTaskWorker": {
"Addr": [ "127.0.0.1:1883" ],
"AppName": "default"
}
}