[英]How do I pass a List<int> from one job to another?
I'd like to create a workflow so that the first job gets some ids from a database and passes them to the subsequent jobs. 我想创建一个工作流,以便第一个作业从数据库中获取一些ID,并将其传递给后续作业。 It's expensive to get the ids so I'd prefer to do it only once in the master job. 获取ID的成本很高,所以我宁愿在主工作中只做一次。 The other jobs should just modify the data in their own way. 其他作业应仅以自己的方式修改数据。
I've found a similar question about how this can be achieved: Quartz.Net and passing data between chaining jobs however I'm not sure whether this is a good idea because the documentation suggests otherwise: 我发现了一个有关如何实现此目标的类似问题: Quartz.Net以及在链接作业之间传递数据,但是我不确定这是否是一个好主意,因为文档中另有说明:
Only store primitive data types (including strings) in JobDataMap to avoid data serialization issues short and long-term. 仅在JobDataMap中存储原始数据类型(包括字符串),以避免短期和长期的数据序列化问题。
Quartz.NET - Best Practices Quartz.NET-最佳实践
What can happen if I put a List<id>
on to the JobDataMap
? 如果将List<id>
放在JobDataMap
上会发生什么? Is there another way for doing this? 还有另一种方法吗?
You are right in stating that List<int>
is not primitive. 您正确地指出List<int>
不是原始的。 Rather, it is a finite set of primitive values. 相反,它是一组有限的原始值。 However, since string
s are considered to be primitive, you can encode your list into a JSON string
, so it will be primitive. 但是,由于string
被认为是原始的,因此您可以将列表编码为JSON string
,因此它将是原始的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.