yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
626 stars 185 forks source link

Agent疑问 #114

Closed bao2314483 closed 3 years ago

bao2314483 commented 3 years ago

我怎么设置Agent属于哪个队列(QueueName)呢? 我的需求是这样HttpJob Server属于总部公司运行着,然后每个分公司都部署一个Agent服务, 目前只有在HttpJob Server设置DefaultRecurringQueueName,然后下面的Agent都默认这个DefaultRecurringQueueName值, 问题来了 比如分公司A的Agent-A的任务会跑到分公司B的Agent-B执行,但是分公司AB的网络之间网络不同的,而跟总部网络是通的, 请问怎么解决

PS:简单来说我想设置每个Agent属于QueueName,这样子就不会导致多个Agent的任务之间到处乱跑了,因为多个Agent之间不一定是在同一个网络中的

yuzd commented 3 years ago

agentjob 可以修改queuename的 image

bao2314483 commented 3 years ago

可能你理解错我的意思.比如我现在需求是这样 HttpJob Service --总公司机房运作服务 AgentJob-A Service --分公司A机房运作服务,QueueName:GroupA AgentJob-B Service --分公司B机房运作服务,QueueName:GroupB AgentJob-C Service --分公司C机房运作服务,QueueName:GroupC

AgentJob-A/B/C互相之间网络是不通的,但是跟总公司机房网络是相通

目前我测试发现AgentJob-A/B/C归属哪个QueueName是通过HttpJob Service的配置DefaultRecurringQueueName来设置的,但是不能单独设置为AgentJob-A/B/C三个服务分别设置归属队列名为GroupA/B/C

这个需求怎么解决呢?还是我把HttpJob和AgentJob之间的理念搞错了?

yuzd commented 3 years ago

HttpJob Service --总公司机房运作服务 AgentJob-A Service --分公司A机房运作服务,QueueName:GroupA AgentJob-B Service --分公司B机房运作服务,QueueName:GroupB AgentJob-C Service --分公司C机房运作服务,QueueName:GroupC

AgentJob-A/B/C互相之间网络是不通的,但是跟总公司机房网络是相通

HttpJob Service 可以调度 AgentJob-A -》没错吧

HttpJob Service 可以调度 AgentJob-B -》没错吧

HttpJob Service 可以调度 AgentJob-C -》没错吧

那么我就开发3个工程 分别是AgentJob A/B/C 但是要注册一下,对应的工程名称要类名要叫不一样。 比如你有一个JOb叫 test。那么对应三个agent 分别叫 testA testB testC

然后分别部署: AgentJob A 部署到分公司机房A AgentJob B 部署到分公司机房B AgentJob C 部署到分公司机房C

且对应的注册到 【HttpJob Service --总公司机房运作服务】 注册成功后,在httpjob的面板上分别设置queueName

这样就能实现 总公司的调度分别去调度 分公司的。分公司之间是隔离的。