-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用agent.job 想先登陆获取用户token,再带token去访问agent.job,无法实现 #202
Comments
请问可以再job.agent里面打印表头这种操作吗?或者带入的参数 |
你是希望拿什么信息呢? |
jobContext对象里面有个Headers 你试试 |
hangfire是通过http方式请求调度agent的 如果你在agent上加过滤器的话 可能你需要把你的过滤器middlerware的顺序放在hangfireagent的middlerware的前面才会生效把。 |
|
即使放最后注册中间件也无法获取,请问有合适的解决方案推荐吗? |
建议啦代码调试下 |
agent的请求接收是封装在一个middreware的 |
原来被替换了 依赖注入没有,感觉像是HttpContextAccessor的使用方式有点问题 |
我看了下源码,开了一个线程去执行这个任务,但是依赖注入被替换了. 这应该算是程序BUG把? 你提供的方法,解决不了,因为IHttpContextAccessor 为null,如何调用也是null |
demo,我发你qq邮箱了 |
好的 我看下 |
agent的job收到了server的调度的时候,会开启一个新的线程去执行,只有这样才能执行长时间运行的任务,是这么设计的 不建议在Onstart方法里面去读取IHttpContextAccessor.HttpContext |
多谢了,作者大大! |
好的 |
配置信息:
{
"Success": {
"Url": "http://localhost:5566/jobagent",
"Method": "Post",
"Data": "",
"ContentType": "application/json",
"Timeout": 20000,
"QueueName": "recurring",
"AgentClass": "SRM.Application.Job.PerformanceAppraisalJob,SRM.Application",
"Headers": {
"Authorization": "#{#parent.data}"
},
"BasicUserName": "admin",
"BasicPassword": "test"
},
"RecurringJobIdentifier": "绩效考核定时任务",
"Url": "http://localhost:5566/login",
"Method": "Post",
"Data": "{"userName":"test-admin","password":"123456"}",
"ContentType": "application/json",
"Timeout": 20000,
"DelayFromMinutes": 15,
"Cron": "0 0 31 2 *",
"JobName": "绩效考核定时任务",
"QueueName": "recurring",
"AgentTimeout": 0,
"SendSuccess": false,
"SendFail": false,
"Mail": "",
"EnableRetry": false,
"RetryTimes": 0,
"BasicUserName": "admin",
"BasicPassword": "test",
"Headers": {}
}
日志:
The text was updated successfully, but these errors were encountered: