Comments (23)
from hangfire.httpjob.
from hangfire.httpjob.
请问可以再job.agent里面打印表头这种操作吗?或者带入的参数
from hangfire.httpjob.
from hangfire.httpjob.
你是希望拿什么信息呢?
有试过从jobContext里面拿param吗
from hangfire.httpjob.
from hangfire.httpjob.
from hangfire.httpjob.
jobContext对象里面有个Headers 你试试
from hangfire.httpjob.
获取没问题了
再冒昧的请教一个问题,我查询数据添加了sqlsugar的过滤器,会为所有表格添加一个过滤条件,但是这个过滤条件是从jwt鉴权的信息里面获取,但是我看job.agent 带上头部也不会获取到鉴权信息,job.agent是不是不是不是通过http方式实现的?事通过什么方式实现的? 请问我这个问题,有方法解决吗?
from hangfire.httpjob.
from hangfire.httpjob.
hangfire是通过http方式请求调度agent的
如果你在agent上加过滤器的话 可能你需要把你的过滤器middlerware的顺序放在hangfireagent的middlerware的前面才会生效把。
https://github.com/yuzd/Hangfire.HttpJob/blob/master/Agent/Hangfire.HttpJob.Agent/JobAgentMiddleware.cs
from hangfire.httpjob.
你如果有时间的话,https://github.com/wanglei8888/HuanTian 这里有demo(HuanTian.Store项目),里面有我的注册顺序
from hangfire.httpjob.
即使放最后注册中间件也无法获取,请问有合适的解决方案推荐吗?
from hangfire.httpjob.
建议啦代码调试下
理论上控制middreware的顺序应该是可行的额
from hangfire.httpjob.
agent的请求接收是封装在一个middreware的
如果你的filter 能作用在这一层之前拿到请求进行处理 应该是可行的
from hangfire.httpjob.
因为有默认的Authorization,替换成其他的就可以了。
明明依赖注入的时候有值,但是进入方法之后,IHttpContextAccessor 值又为null了,不知道为什么
from hangfire.httpjob.
原来被替换了
依赖注入没有,感觉像是HttpContextAccessor的使用方式有点问题
你参考下
https://stackoverflow.com/questions/52927463/access-httpcontextaccessor-from-startup-cs-in-net-core-webapi
from hangfire.httpjob.
我看了下源码,开了一个线程去执行这个任务,但是依赖注入被替换了. 这应该算是程序BUG把? 你提供的方法,解决不了,因为IHttpContextAccessor 为null,如何调用也是null
from hangfire.httpjob.
demo,我发你qq邮箱了
from hangfire.httpjob.
好的 我看下
from hangfire.httpjob.
agent的job收到了server的调度的时候,会开启一个新的线程去执行,只有这样才能执行长时间运行的任务,是这么设计的
至于为啥IHttpContextAccessor 对象的HttpContext为啥为null
在Construct构造方法的时候你看是有值的。
但是由于是异步执行job的OnStart方法,
执行构造方法的http请求线程已经处理完了,导致HttpContext变成null
不建议在Onstart方法里面去读取IHttpContextAccessor.HttpContext
你需要用到header信息应该直接从JobContext上下文中去拿
from hangfire.httpjob.
多谢了,作者大大!
我用的sqlSugar租户过滤器,每次查询都需要获取当前登陆用户的租户、 那看来使用httpjob更好一些,能完全契合框架,jobAgent不太适合我这种
from hangfire.httpjob.
好的
from hangfire.httpjob.
Related Issues (20)
- blazor server模式下。多个任务提交异常 HOT 7
- 是否可以保存上一次运行的Data,并在下一次运行中获取到这个数据。 HOT 1
- About Agent Persistence HOT 4
- 编辑周期任务,多success层级,保存丢失问题 HOT 1
- 时间显示问题 HOT 3
- 暂停重启后任务无法执行 HOT 2
- err:x-job-agent-action in headers can not be empty! HOT 3
- httpjob只会在启动项目注册 HOT 6
- AddRecurringJob 添加QueueName无法保存 HOT 3
- redis 数据库消息不会失效,导致服务器内存给占满 HOT 2
- 語系顯示問題 HOT 1
- Hangfire.Tags Deprecated, update to https://github.com/face-it/Hangfire.Tags HOT 2
- Exception: Could not load file or assembly Hangfire.Tags HOT 5
- Missing HttpJobs Results on UI [Updated] HOT 11
- 使用sqlserver 作为存储无法工作 HOT 3
- 3.8.4 nuget上包有问题 HOT 2
- No tags populated
- 只读模式下 怎么隐藏定期作业下的按钮
- RedisHangfire的Job面板为英文如何解决
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hangfire.httpjob.